4

I was trying to update to the latest Git version in my Terminal. I've no clue what I did and all I remember was that I removed the previous installed Git I think because when i run the following commands:

which git => /usr/local/bin/git
git --version => -bash: /usr/bin/git: No such file or directory
brew install git => Warning: git-2.2.1 already installed
brew doctor => Your system is ready to brew.
brew link git => Warning: Already linked: /usr/local/Cellar/git/2.2.1
$PATH => "/usr/local:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/local/bin:/usr/bin:/bin:‌​/usr/sbin:/sbin"

My question is what should i do next so that I can use Git ?

5

I suspect that git's location is still cached in /usr/bin (the default location). To check this, type:

type git

The result will likely be:

git is hashed (/usr/bin/git)

To fix this, you can simply log out & back in, or clear the hash for git with the following:

hash -d git

Now, running git should work properly.

  • I spent literally half an hour working on this, nowhere else was the hashing mentioned. Thank you! – Joshua Dance Feb 9 '15 at 23:33
  • One of the best answers, working fine with Mac OS. – AMIC MING Dec 19 '18 at 19:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .