-bash: __git_ps1: command not found
7 Comments Published September 22nd, 2012 in Git, OSX Tags: Bash, command line, completion, Git, mac, macports, OSX, port, profile, prompt, ps1, script.Today I updated mac ports and a new error started to show up at the command line saying that the __git_ps1 command is not found.
This is because I added the git branch in my bash prompt long time back and in last update of git-core port they moved the __git_ps1 bash functions to a separate script.
To fix it, you just need to include following lines in your .profile (or .bashrc):
if [ -f /opt/local/share/doc/git-core/contrib/completion/git-prompt.sh ]; then
. /opt/local/share/doc/git-core/contrib/completion/git-prompt.sh
fi
It worked for me.
Depending on your git installation, this file may be located elsewhere; find command should help in this case.
Update 30-03-2013:
They changed the location of those files again. Super!
now they are here:
/opt/local/share/git-core/contrib/completion/git-completion.bash /opt/local//share/git-core/contrib/completion/git-prompt.sh
just include them.
Hope they won’t change the paths again soon :)
7 Responses to “-bash: __git_ps1: command not found”
- 1 Pingback on Nov 18th, 2012 at 22:09
Leave a Reply
Search
Calendar
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Jul | Nov » | |||||
| 1 | 2 | |||||
| 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| 24 | 25 | 26 | 27 | 28 | 29 | 30 |
Follow me
Archives
Categories
- Android (3)
- Apple (29)
- Books (7)
- Eclipse (14)
- Errors (5)
- Firefox (7)
- Git (3)
- Hardware (18)
- Horror Code (8)
- Internet (21)
- Java (104)
- JavaScript (9)
- Life, universe and everything (45)
- Lifehacks (26)
- Linux (52)
- Opinions (26)
- OSX (11)
- OWNER API (2)
- Python (1)
- Software (33)
- Speeches and Conferences (8)
- Unix (5)
- Web (23)
- Windows (19)
Tag Cloud
Android apple architecture Bash configuration CSS Development Düsseldorf Eclipse Git Google Hardware hdr How-To howto Java JAXB job Karmic Linux lion MacBook music Open Source Opinion OSX os x patterns Pitfalls Practices Resume Security Software Suspend TDD Testing tip tonemapped Tricks Ubuntu unix video Web Workaround XML
WP Cumulus Flash tag cloud by Roy Tanck and Luke Morton requires Flash Player 9 or better.
Blog License
Blogs I like
Books on the desk
Friends' Blogs
- Antonio Terreno & Valter Bernardini
- Bruno Bossola
- Daniele Galluccio
- Domenico Ventura
- Ed Schepis
- Fabrizio Gianneschi
- Luca Grulla
- Luigi Zanderighi
- Marcello Teodori
- Mida Boghetich
- Muralidharan Chandrasekaran
- Piero Ricca
- Renzo Borgatti
- Simone Bordet
- Simone Bruno
- Uberto Barbini
- Valvolog
- Webtide blogs (Greg Wilkins & Jan Bartel)
Links


















I had this problem aswell. Thanks for the tip, it worked for me.
I was just wondering, how did you figure out that they moved the __git_ps1 bash functions?
Chris, I don’t remember exactly. At first I checked if set contained the __git_ps1 function, using grep and less, then I checked if they moved the git-completion.bash somewhere else, using find, but it was still at the same place as before. Then I searched around to find __git_ps1 function and it was easy since in the directory /opt/local/share/doc/git-core/contrib/completion there were just two files: git-completion.bash and git-prompt.sh.
Thanks Luigi. It was super helpful. My bash prompt broke down after my recent update of git installation.
thanks for the tip, my .profile now looks like this:
# Set git autocompletion and PS1 integration
GIT_COMPLETION_FILE='/opt/local/share/doc/git-core/contrib/completion/git-completion.bash';
GIT_PROMPT_FILE='/opt/local/share/doc/git-core/contrib/completion/git-prompt.sh'
if [ -f $GIT_COMPLETION_FILE ]; then
. $GIT_COMPLETION_FILE
fi
if [ -f $GIT_PROMPT_FILE ]; then
. $GIT_PROMPT_FILE
fi
GIT_PS1_SHOWDIRTYSTATE=true
PS1='\[33[32m\]\u@\h\[33[00m\]:\[33[36m\]\w\[33[31m\]$(__git_ps1)\[33[00m\]\$ '
They changed the location of those files again. Super!
now they are here:
freaking hell, why do they keep changing this all the time. Thanks for the update :)