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

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 and go back to my normal command line in Terminal? I on Mac OS X.

I have tried typing exit, Ctrl+c, q, etc. but nothing helped.



Solution 1:[1]

You must have installed something (I'm not sure what) that modified your prompt to give you context-sensitive information about the Git repository (if any) you're in.

Simply adding

export PS1="\h:\W \u\$ "

at the very bottom of your

  • ~/.bash_profile file, if you use bash, or
  • ~/.zshrc file, if you use zsh,

and then sourcing that file (or restarting Terminal) should rid you of that fancy colourful prompt.

Solution 2:[2]

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.

Solution 3:[3]

There is nothing wrong with your system or you change something involuntarily. You must have download oh-my-zsh and set your default terminal from bash to zsh. Oh-my-zsh has many different themes, all these themes have different appearances and provide more efficient functions, git information is one of them. The default theme of oh-my-zsh is "robbyrussell" and it just looks like your shell prompt. You can go to "~/.oh-my-zsh/themes" to choose your favorite theme and apply it to the configuration file "./zshrc". I know you have solved the problem by uninstalled the zsh and use the original bash, I just want to tell you the essential reason of this problem. And oh-my-zsh truly provides some convenience which helps you use the command line, maybe you should try it again!

Solution 4:[4]

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.

Solution 5:[5]

Open your ZSH config file

sudo vim ~/.zshrc

and paste below command at the bottom of the file

PROMPT='${ret_status} %{$fg[cyan]%}%c%{$reset_color%} '

this will show current directory

Solution 6:[6]

I also has this problem like: "? ~ git:(master) ?" on the Mac OS X. Because I type the command "git init".

When I type the command "rm -R .git", it comes back into normal command line in Terminal. PS: I use zsh.

Solution 7:[7]

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.

Solution 8:[8]

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 addded 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

Solution 9:[9]

Use this following command:

git config oh-my-zsh.hide-info 1

Solution 10:[10]

if you having seen the (master) in somewhere your folder. try this

git rm .git

It will automatically remove the master