CentOS – bash: __git_ps1: command not found

When I was working on a project for my company, I found myself wanting to mimic live environment. In this case I used Vagrant. I made a development environment using PHP5.3 and latest CentOS distribution. Other than that I wanted to add my .bashrc file, so that I have my PS1 configuration for showing current directory and git_ps1 for showing current GIT branch. After adding this file to my system I received a following error:
bash: __git_ps1: command not found

Simple solution to this unforeseen problem is:

  1. Get: https://raw.github.com/git/git/master/contrib/completion/git-prompt.sh and change filename to ie. .git-prompt.sh
  2. Add line: source ~/.git-prompt.sh to the .bash_profile file
  3. Console restart

And that’s all. Now we can see the current branch is working fine.

Dodaj komentarz

Twój adres email nie zostanie opublikowany. Pola, których wypełnienie jest wymagane, są oznaczone symbolem *