My shell prompt looks like this: ➜ ~ git:(master) ✗. How can I get my normal prompt back?

前端 未结 10 1817
别跟我提以往
别跟我提以往 2021-01-03 07:56

My normal terminal command line has suddenly disappeared and has been replaced by this git command line ➜ ~ git:(master) ✗.

How do I get rid of this an

相关标签:
10条回答
  • 2021-01-03 08:36

    I'm assuming you entered "git init" like I did. It took me a while to figure this out, but when you entered "git init" you created a hidden git folder named ".git".

    You can see the folder by going to your home directory and typing "ls -a".

    Simply remove the file (rm -rf .git), and the prompt will magically disappear.

    0 讨论(0)
  • 2021-01-03 08:37

    Just ran into this problem. Sharing how I resolved for my future self.

    When switching to zsh in home/username, the shell shows git:(master). This is due to 2 things: 1. You have installed a Git package for ZSH 2. You have likely created a .git repo under home/username so zsh is picking it up from your current location.

    Steps to resolve: 1. Type ls -a into terminal and you will be able to see .git and .gitconfig files 2. Move .git and .gitconfig files to your specified git repository folder with mv .git ./git_repositories/ and mv .gitconfig ./git_repositories/ 3. type bash into terminal then type zsh into terminal and it should resolve the issue.

    0 讨论(0)
  • 2021-01-03 08:38

    There seems to be a few command line tools that work together with Git that add those customizations.

    In my case after installing Drush I got my ~/.bashrc file updated with Drush-specific customizations, which in this case affffded a green (master *) $ to the prompt, no matter where I was (very annoying).

    Fixed it by commenting out the block after # Include Drush prompt customizations. in my ~/.bashrc and then source ~/.bashrc

    0 讨论(0)
  • 2021-01-03 08:39

    This happened to me when getting my head around zsh and git. I created a git repo in the wrong folder and started seeing this zsh context. Because I didn't want a repo in this directory I removed the git information with:

    rm -R .git

    Note you will only want to do this if you have an invalid git repository.

    0 讨论(0)
提交回复
热议问题