Skip to main content

How to add GIT to windows PATH environment variable

Summary


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

  1. Left-click on the Windows Start Menu and Click on the gear icon to open windows settings.
  2. In the “Windows Settings” window, search for "System Environment Variable".
  3. Now select "Edit the system environment variables".
  4. Next, click the "Environment Variables" button at the bottom-right on the System Properties dialog box.
  5. 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.
  6. 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.
  7. Close all open windows
  8. Finally, close and re-open your PowerShell or Command Prompt to reload Path variables.

 

Special Note:

  • 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:

  1. 5 ways to redirect or navigate a URL using JavaScript