Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I manually installed git 1.6 a year or two ago. I noticed today that the 1.7 version is available in yum, and installed it (package git-all) I now get the following output:

[root@ovz5197 ~]# git --version
bash: /usr/local/bin/git: No such file or directory
[root@ovz5197 ~]# which git
[root@ovz5197 ~]# /usr/bin/git --version
git version
[root@ovz5197 ~]# 

Any idea why the output of which seems to contradict the first line above?

share|improve this question
I was tempted asking you for what your $PATH variable look like, but as which git is finding it, it should be ok. However, the reason might be in your $PATH? – Torbjörn Sep 15 '11 at 15:26
What does ls -l /usr/local/bin/git show? And file /usr/local/bin/git? – Gilles Sep 16 '11 at 0:04
up vote 7 down vote accepted

If you had already run git from this instance of bash back when there was a /usr/local/bin/git, it's remembering the old location in a cache. Run hash -r to clear the cache. Each instance of bash has its own cache, so newly started instances of bash will look in the right place.

Otherwise, you evidently have a file /usr/local/bin/git, and it's executable, but it doesn't work because its loader is not present on the system. See Can't execute some binaries in chroot environment (zsh: Not found) for a similar case.

share|improve this answer
Yes it must have been a cache - the behaviour is as expected now, thanks very much for explaining! – EoghanM Sep 16 '11 at 11:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.