Monday, 12 October 2015

Git doesnot work after upgrading Mac OS X EI Capitan (v10.11)

git-completion.bash to work on Mac OSX

1) sudo brew update
2) sudo brew doctor
3) brew install git
4) Now, its time to check git --version

Display git branch name not working after upgrading to EI Capitan OSX

1) cat ~/.bash_profile 
Output
export JAVA_HOME=$(/usr/libexec/java_home)
source /Library/Developer/CommandLineTools/usr/share/git-core/git-prompt.sh
PS1="[\[\033[32m\]\w]\[\033[0m\]\$(__git_ps1)\n\[\033[1;36m\]\u\[\033[32m\]$ \[\\033[0m\]"export PATH="/usr/local/bin:$PATH"

2) source ~/.bash_profile
Error: -bash: /Library/Developer/CommandLineTools/usr/share/git-core/git-prompt.sh: No such file or directory

3) Edit the path "/usr/local/etc/bash_completion.d/git-prompt.sh" and then source ~/.bash_profile
cat ~/.bash_profile 
Output
export JAVA_HOME=$(/usr/libexec/java_home)
source /usr/local/etc/bash_completion.d/git-prompt.sh
GIT_PS1_SHOWDIRTYSTATE=true
export PS1='[\u@OSX-Capitan \w$(__git_ps1)]\$ '
export PATH="/usr/local/bin:$PATH"

Another solution: Reinstalling Xcode Command Line Tools via Terminal
xcode-select --install

No comments:

Post a Comment