I have previously installed Git(1.9.3) and I want to upgrade it to the latest version(2.0.1). I uninstalled the previous install by running the uninstall.sh first and then git.pkg. However, when I run git --version
, it still shows me git version 1.9.3 (Apple Git-50)
.
So I did this:
$ which git
/usr/bin/git
$ echo $PATH
...:/usr/local/git/bin
Obviouslly, Git in /usr/local/git/bin is the latest version I want.
So how can I remove the path of the older version and tell Mac OSX where to find the right version?
Thanks!
One solution would simply to change the order in your $PATH
in your ~/.bash_profile
export PATH=/usr/local/git/bin/:$PATH
source ~/.bash_profile
As suggested in git: command not found (on OS X 10.5) and Locate Git installation folder on Mac OS X.
In your case, you do have /usr/local/git/bin/
in your PATH
, but in the wrong order if you want it to be taken into account.
XCode uses its own git version, which makes it a bit difficult to update. These two terminal commands worked for me:
sudo mv /usr/bin/git /usr/bin/git-xcode
sudo ln -sf /usr/local/git/bin/git /usr/bin/git
This solution is taken from Heroku's recently published seurity alert for git 1.9.3. This post includes a download link. These two commands are advised in that link. The .dmg download package also includes a README file with a similar link.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With