Add Git to PATH on Windows

Git is a free, open-source version control system designed to handle projects quickly and efficiently. You can use this on Windows, Mac and Linux operating systems.
This article will explain how to add the git to the Windows PATH environment variable.
Add git
to the PATH
on Windows
Git executable files are located in the C:\Program Files\Git\bin\git.exe
and C:\Program Files\Git\cmd
. These directories must be added to the PATH
environment variable to run the program.
Let’s explain step by step how to do this.
Navigate to the System Properties on Windows
Environment variables are located under the System Properties. We can navigate there by typing edit environment variables
in the search box and clicking on the best match.
Another way to do this is as follows.
- Right-click on the
This PC
. - Select the
Properties
tab.
- Scroll and click on the
Advanced System Settings
.
Edit Environment Variables to Add Values to the PATH
Variable
Click Environment Variables
under System Properties
to add values to the PATH
.
Select Path
under the System variables
and click the Edit
button.
Click the New
button and add the C:\Program Files\Git\cmd
value. Save it and repeat the same process for the C:\Program Files\Git\bin\git.exe
.
If your executable files are located in the C:\Users\<user>\AppData\Local\GitHub\PortableGit_<guid>\bin
and C:\Users\<user>\AppData\Local\GitHub\PortableGit_<guid>\cmd
directories, add them to the Path variable.
Save the changes and close the page.
Run the git
Command on Windows Command Prompt
Open a new command prompt. Type git --version
and press enter. The program has been successfully added to the path environment variable if you see the version information.
Yahya Irmak has experience in full stack technologies such as Java, Spring Boot, JavaScript, CSS, HTML.
LinkedIn