-bash: __git_ps1: command not found

I tried to install Ruby 2.0. My command line urped and now looks like the following:

-bash: __git_ps1: command not found
[11:58:28][whatever@whatever ~]$ 

I have not a clue how to get rid of the __git_ps1 command not found error. I've searched my .bash_profile and my .bashrc to see if it's trying to set a variable or something and am not seeing anything. The only place I can find git_ps1 mentioned is in ~/.dotfiles/.bash_prompt. I replace the content of that file completely, logout and log back in and it fixes nothing.

I saw this, but I'm pretty new to command line so I just confused myself.

Any ideas?


Run the following:

$ curl -L https://raw.github.com/git/git/master/contrib/completion/git-prompt.sh > ~/.bash_git

And add this to the top of your ~/.bashrc:

source ~/.bash_git

Re-login to your shell and you should be set.


Search your system for a git-prompt.sh, you need to source that for the __git_ps1 function to be available. In Arch, it is currently located at /usr/share/git/completion/git-prompt.sh. Add

source /path/to/git-prompt.sh

to some suitable shell script. If you're unsure where, add it to your ~/.bashrc.

If you have locate installed, you can use that to find the git-prompt.sh file, but you may need to run updatedb as root first.