16
3
I'm encountering a really weird issue when I try to use the latest version of git I just installed via homebrew. which git
is pointing me to the homebrew install, but calling git
returns the original version installed with OS X.
I checked first to see the original version I was on.
[user@home ~]$ git --version
git version 1.8.5.2 (Apple Git-48)
Then I went to homebrew to install the latest version.
[user@home ~]$ brew install git
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/git-2.0.0.mavericks.bottle.2.tar.gz
######################################################################## 100.0%
==> Pouring git-2.0.0.mavericks.bottle.2.tar.gz
==> Caveats
The OS X keychain credential helper has been installed to:
/usr/local/bin/git-credential-osxkeychain
The 'contrib' directory has been installed to:
/usr/local/share/git-core/contrib
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
zsh completion has been installed to:
/usr/local/share/zsh/site-functions
==> Summary
/usr/local/Cellar/git/2.0.0: 1324 files, 31M
Looks like it worked! Check that it's pointing to the correct git
[user@home ~]$ which git
/usr/local/bin/git
Should be good, right? Not so fast
[user@home ~]$ git --version
git version 1.8.5.2 (Apple Git-48)
That's weird. Am I really pointing to the right git?
[user@home ~]$ ls -l /usr/local/bin/git
lrwxr-xr-x 1 user group 27 Jul 3 15:54 /usr/local/bin/git -> ../Cellar/git/2.0.0/bin/git
Sure looks like it. Works when I call it manually
[user@home ~]$ /usr/local/Cellar/git/2.0.0/bin/git --version
git version 2.0.0
But not as git
[user@home ~]$ which git
/usr/local/bin/git
[user@home ~]$ git --version
git version 1.8.5.2 (Apple Git-48)
Any ideas as to what could be causing this?
EDIT: Solved it. source .bashrc
fixed it. Still curious as to why which
would return me the correct executable but it wouldn't be called though, if anyone can explain that.
Not sure exactly what the problem is, but it sounds like you might want to have a look at the current value of
$PATH
. – Zev Eisenberg – 2014-07-03T22:36:37.8133if you wanna see all versions of git you have installed use -> which -a git - (which git, just gives you back the path of the first found one in your PATH variable) to see what paths you have in your PATH do a -> echo $PATH – konqui – 2014-07-05T07:13:58.480