Super User is a question and answer site for computer enthusiasts and power users. 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

On my Windows 2008 VM, I have Git installed. When I run following command

where git

I get following output

C:\Program Files (x86)\Git\cmd\git.cmd
C:\Program Files (x86)\Git\cmd\git.exe

but when I run git on command prompt I get following error

'git' is not recognized as an internal or external command,
operable program or batch file.

I have confirmed that git is included in my PATH. Here is what my PATH

PATH=C:\Ruby\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Java\jre6\bin;C:\Program Files\Microsoft Windows Performance Toolkit\;C:\Program Files (x86)\Mozilla Firefox\;C:\Program Files\NCover\;C:\Program Files (x86)\nant-0.91-alpha2\bin;D:\Tools;C:\OpenSSL-Win64\bin;C:\Windows\system32\dns\bin;C:\Program Files\TortoiseSVN\bin;C:\tools;C:\DevKit;C:\ansi160\x64;"C:\Program Files (x86)\Vim\vim73;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\nodejs\;C:\Program Files (x86)\Git\cmd;C:\Chocolatey\bin;C:\PhantomJS;C:\Users\suhas.chatekar\AppData\Roaming\npm;D:\SystemTools\cmder;

What could be going wrong here?

share|improve this question
Could you please put out your path variable and the command that you are using. – Gaurav Joseph Jan 10 '14 at 10:08
Does running "git.exe" rather than just "git" make any difference? – Andy Davies Jan 10 '14 at 10:09
@GauravJoseph Added my PATH variable in the original question – Suhas Jan 10 '14 at 10:26
@AndyDavies Running git.exe gives the same error – Suhas Jan 10 '14 at 10:26
up vote 1 down vote accepted

The quote in your path may be the problem.

I feel that the spaces may be the problem though I can't be sure. There is one thing you can try:

Fire up the command prompt

SET PATH="C:\Program Files (x86)\Git\cmd" (notice the quotes)

now type git

If all is well then you should move your git to some path with no spaces or simply use inverted commas.

share|improve this answer
I guess you mean "quotes" rather than "inverted commas". But that can't be the issue; the paths inside the path variable don't need quotes since they're delimited by ; rather than space. – Mario Jan 10 '14 at 10:34
So that seems to work. I have this problem with lot of other commands that are present in the PATH. Is there is a better way to fix this? – Suhas Jan 10 '14 at 10:34
@Suhas: have you made sure you've got the right PATH variable in your command prompt? Maybe it's somehow overwritten the way you launch the console window? What happens if you run echo %PATH% instead of git (in a new console)? – Mario Jan 10 '14 at 10:35
All Operating Systems have this problem. This is due to a fact that the string after the space is taken to be an argument passed to the supposed program in the first string. – Gaurav Joseph Jan 10 '14 at 10:37
@Mario Output of echo %PATH% is in the original question – Suhas Jan 10 '14 at 10:40

You must log in to answer this question.

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