I had to install git from source on RHEL. After installation the git command is shown to be in /usr/local/bin/git when trying the whereis command.This path is available in $PATH also.

When I type git it still says "Command not found." How to resolve this?

EDIT : output of various commands

$type git
type: Command not found.

$which git
git: Command not found.

$ls -l /usr/local/bin/git
-rwxr-xr-x 112 root users 5851488 Mar 15 20:07 /usr/local/bin/git

$whereis git
git: /usr/local/bin/git

$echo $PATH

EDIT: It works now but do not know why

I disconnected the telnet connection and logged in again few minutes back and find that the git command works. I am not sure what caused it to start working. This is confusing.

  • Please add the type git, which git, ls -l /usr/local/bin/git outputs.
    – manatwork
    Mar 15, 2013 at 15:10
  • @manatwork please see the edit.
    – Manoj
    Mar 15, 2013 at 15:17
  • @Marco added the output of echo $PATH.
    – Manoj
    Mar 15, 2013 at 15:18
  • 1
    I guess @manatwork meant file and not type ;-) so he wants (and I too) to see the output of file /usr/local/bin/git
    – Huygens
    Mar 15, 2013 at 15:58
  • 1
    @Huygens, type is a shell builtin in dash, bash and zsh. In case you use ksh, you may have a good excuse for not knowing it. (In my ksh there is just an alias to whence with the name type. Not sure how widespread is such setting.) pastebin.com/VzScxzRg
    – manatwork
    Mar 15, 2013 at 16:23

3 Answers 3


From the error messages you're using (t)csh. It would help to mention it in your question, especially as you're showing $ as your prompt, and that's traditionally a Bourne prompt, not a csh prompt.

type is a builtin in Bourne-style shell. It doesn't exist in csh. When you run type git, it tells you that the type command is not found.

Many shells keep information about the location of commands in the search path in a cache. I don't know if any version of csh caches negative lookups, but it seems that yours does. Run the command rehash to refresh the cache. When you start a new shell instance, it has a fresh cache and so doesn't remember that git was not present earlier.

  • Hi Gilles, I should have mentioned the shell. Sorry for that. But I get $ in the prompt for both bash and tcsh. in tsch it is [username@systemname]$ format and in bash it is bash-3.2$ format.
    – Manoj
    Mar 18, 2013 at 7:25
  • I think this is the closest possible explanation to what happened. I will try to recreate this and verify and get back. Thanks...
    – Manoj
    Mar 18, 2013 at 7:26

Make sure that, as in this thread, your shell hasn't changed from the one you are supposed to get:

I have just found that my shell got changed to csh and it was creating the problem.

[root@localhost ~]# grep ^"$USER" /etc/passwd

I changed it to bash and the problem was resolved!

[root@localhost ~]# type export
export is a shell builtin

That would explain why you get a 'type: Command not found.' error message.

I experimented with these commands:

[root@localhost ~]# csh
[root@localhost ~]# type export
type: Command not found.
[root@localhost ~]# bash
[root@localhost ~]# type export
export is a shell builtin
[root@localhost ~]# grep ^"$USER" /etc/passwd
  • Changing the shell to bash causes the 'type' command to work. The git command works now even without going into bash. Do not know why! Please see the edit.
    – Manoj
    Mar 15, 2013 at 17:14

The most probable reason is that you have the correct PATH but not the correct LD_LIBRARY_PATH.

The latest git executable is a binary file which is dynamically linked. When you followed the installation instructions, it probably placed libraries (.so files) in /usr/local/lib, you need to add this path to your LD_LIBRARY_PATH. Try it and then run git:

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib

If that does not work, could you provide the output of ldd /usr/local/bin/git. Thanks.

PS: if the solution worked, you need to add the LD_LIBRARY_PATH line to your .bash_profile

You must log in to answer this question.

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