Add Git to PATH on Windows

Yahya Irmak Dec 21, 2022 Feb 11, 2022 Git Git Path
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.

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.

search edit environment variables

Another way to do this is as follows.

  1. Right-click on the This PC.
  2. Select the Properties tab.

pc properties

  1. Scroll and click on the Advanced System Settings.

advanced system settings.png

Edit Environment Variables to Add Values to the PATH Variable

Click Environment Variables under System Properties to add values to the PATH.

environment variables

Select Path under the System variables and click the Edit button.

edit system variables

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.

add git to path

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.

check git version on cmd

Author: Yahya Irmak
Yahya Irmak avatar Yahya Irmak avatar

Yahya Irmak has experience in full stack technologies such as Java, Spring Boot, JavaScript, CSS, HTML.

LinkedIn