When working with GIT on windows, you may have need of accessing GIT command from any directory or software application. One of the most common examples is accessing GIT.exe using the command prompt from a directory outside the GIT’s installation directory.
You may have often saw the following error as well when you’re not able to access GIT command
'git' is not recognized as an internal or external command,
operable program or batch file.
To fix this error, you will need to set the GIT installation directory path to Windows 10 Environment Variables. Follow the steps below on
Steps to set Windows PATH Environment Variables
- Left-click on the Windows Start Menu and Click on the gear icon to open windows settings.
- In the “Windows Settings” window, search for "System Environment Variable".
- Now select "Edit the system environment variables".
- Next, click the "Environment Variables" button at the bottom-right on the System Properties dialog box.
- Double-click on the "Path" entry under "System variables". If you wish to do it for yourself then double click on the “Path” entry under your User.
- Next, click on "New" button and add the following two paths C:\Program Files\Git\bin\ and C:\Program Files\Git\cmd\ to the end of the list.
- Close all open windows
- Finally, close and re-open your PowerShell or Command Prompt to reload Path variables.
- Your GIT installation folder can be different that “C:\Program Files\Git\”. Make sure to check and add the folder path as per your computer’s installation directory.
- Make sure to close all command prompt and PowerShell to reload the windows PATH variables before testing the changes.
More useful tutorials: