This question already has an answer here:

I just installed git on CentOS 6.8. When I run the command git from a bash-shell, I get the following error message:

-bash: /usr/bin/git: Bestand of map bestaat niet

Sorry, Dutch installation. Meaning: "File or folder doesn't exist". Git is installed.

When I run /usr/local/bin/git --version, I get the following output:

/usr/local/bin/git: /usr/local/lib/libz.so.1: no version information available (required by /usr/local/bin/git)
git version 2.5.3

(not sure if the libz message is a problem).

which git points to /usr/local/bin/git, so that's fine too. echo $PATH returns /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin. I've looked for aliases and other clues in .bash_profile, .bashrc and /etc/bashrc, but nothing...

How can I run git with just entering the command git?

marked as duplicate by Eric Renouf, Community Mar 24 '17 at 13:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Have you ever run git before while it was in /usr/bin? If you run type git what do you see? – Eric Renouf Mar 24 '17 at 13:11
  • Yes! I've installed it first with yum, but that was git version 1.7. type git says git is gehasht (/usr/bin/git). Some hash cache? How do I clear it? – doekman Mar 24 '17 at 13:17
  • As the other question talks about, bash will cache locations of files it's used so it doesn't have to search the path each time, included there are instructions to either clear a specific file (git here) or the entire cache – Eric Renouf Mar 24 '17 at 13:19

Make a symbolic link between /usr/bin/git and /usr/local/bin/git

ln -s /usr/local/bin/git /usr/bin/git
  • 2
    Yeah, that's a solution. I could also create an alias. But I would rather understand what is going on. Thanks for the answer though. Didn't think of this solution. (I swapped target and link name in your example, but it only shows when it's peer reviewed). – doekman Mar 24 '17 at 13:13
  • 1
    I'm ALWAYS having this issue with ln ... Thanks for the correction. – V.Frenot Mar 24 '17 at 13:19

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