17
3
I have an older version of Git installed at:
/usr/bin/
I recently downloaded a newer version to:
/usr/local/bin
When I type:
which git
I get the location of the old version. I believe that this is just because /usr/bin/ appears before /usr/local/bin in my $PATH variable and so the older version of git is 'found' first.
To test this, I renamed the older version of git to "git_old". Now when I type:
which git
I get the location of the newer version, as expected. But when I type:
git --version
I get the following error:
-bash: /usr/bin/git: No such file or directory
I'm just wondering why my computer is going back to looking in the old location for Git?
2wtf I never knew this, awesome. – djsmiley2k TMW – 2016-07-25T15:34:32.630
1Most other shells do the same thing, but they don't all use
hash -r
to reload the cache. Singer, such as SSH, userehash
as the command instead. – Moshe Katz – 2016-07-26T04:18:44.423PATH=$PATH should clear the cache. hash -r is not needed. – jrw32982 supports Monica – 2016-07-27T20:03:01.053