I was following through the git documentation and installed Git using source code package. Now, after installing Git, I want to update it (Though it might be unnecessary at this time, I simply want to try and make sure it works). I ran the command git clone git://git.kernel.org/pub/scm/git/git.git and it returned error -bash: /usr/bin/git: No such file or directory. Reason might be obvious, since for installing git, I used the command make prefix=/usr/local install which installed Git in /usr/local/bin/git

Now, how to fix this?

I tried the same git clone command with --git-dir=/usr/local/bin/git which returned the same error -bash: /usr/bin/git: No such file or directory


What does hash say? Did you have a /usr/bin/git previously and then removed it? That would lead to bash: /usr/bin/git: No such file or directory while hash still believes git to be there.

The solution in this case would be to either use a new shell. Or for each shell with the old hash, reset it using hash -r.

| improve this answer | |
  • Yes.. I removed one previously.. hash-r worked like a charm.. marking the thread as resolved.. Thank you so much. – Being Gokul Sep 16 '13 at 15:01
  • Another doubt.. The doc says there will be a /etc/gitconfig file.. but I can't find any. Any idea, why it is so? – Being Gokul Sep 16 '13 at 15:08
  • 1
    A global /etc/gitconfig is optional, usually each user has his/her own ~/.gitconfig. Depends on your situation. – frostschutz Sep 16 '13 at 15:11
  • In case, if I need one, I shall create it myself? the global config gile.. – Being Gokul Sep 16 '13 at 15:17
  • 1
    @BeingGokul if you used prefix, the file should be read in /usr/local/etc/gitconfig and/or /etc/gitconfig. Depends the options at configure time. – Braiam Sep 16 '13 at 15:22

Go back and rebuild it without the argument to make. If you want to set the prefix directory, you need to do it with configure, but it defaults to /usr/local anyhow.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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