I’ve installed Git for Windows, but when I try to run the git command in Command Prompt, I get this error:
‘git’ is not recognized as an internal or external command,
operable program or batch file.
I’m not sure what went wrong with the installation or system setup. How can I fix this and make the git command work globally from the terminal? Is this related to the system PATH variable, and if so, how do I set it correctly?
Would really appreciate any help from those who’ve run into this before.
I had the exact same problem after installing Git for Windows. Turns out, the installer didn’t add Git to my system’s PATH variable. To fix it:
Open the Start Menu and type “Environment Variables”.
Click “Edit the system environment variables”, then click “Environment Variables…”.
Under “System Variables,” find the Path variable, hit Edit, and add this line (adjust if you installed elsewhere):
C:\Program Files\Git\bin
Click OK on all windows and restart Command Prompt.
After doing that, run git --version
again, it should work! 
This happened to me too when I rushed through the installation. If Git isn’t recognized, it’s often because the “Add Git to PATH” option was skipped during setup.
Just reinstall Git for Windows, and during installation:
-
Choose “Git from the command line and also from 3rd-party software” when prompted.
-
Continue with default settings.
That auto-adds Git to your PATH correctly. After reinstalling, open a new terminal window and try git --version
. Works like a charm!
One weird quirk I ran into was using an older cmd.exe window I had open before installing Git. Git was installed fine, but it didn’t show up until I closed and reopened my terminal.
Make sure you’re running a fresh instance of Command Prompt or PowerShell, or even better, try Git Bash, which is included in the installer.
Also, double-check if Git is installed at all, go to C:\Program Files\Git
and make sure the /bin
folder exists. If not, it might’ve been a partial install.