JIYIK CN >

Current Location:Home > Learning > OPERATING SYSTEM > Git >

Add Git to PATH on Windows

Author:JIYIK Last Updated:2025/03/26 Views:

Git is a free and open source version control system designed to work with projects quickly and efficiently. You can use it on Windows, Mac, and Linux operating systems.

This article explains how to add git to your Windows PATH environment variable.


On Windows gitaddPATH

The Git executables are located in C:\Program Files\Git\bin\git.exeand C:\Program Files\Git\cmd. These directories must be added to PATHthe environment variable in order to run the program.

Let's explain step by step how to do this.

Navigate to System Properties on Windows

Environment variables are located under System Properties. We can edit environment variablesnavigate there by typing in the search box and clicking on the best match.

Search for Edit Environment Variables

Another method is as follows.

Computer properties

  1. Scroll and tap 高级系统设置.

Advanced system settings.png

Edit the environment variables to add the value to PATHthe variable

Click Add value to 系统属性under .环境变量PATH

Environment variables

Select 系统变量the 路径and click 编辑the button.

Editing System Variables

Click Newthe button and add C:\Program Files\Git\cmdthe value. Save it and C:\Program Files\Git\bin\git.exerepeat the same process for .

Add git to your path

If your executables are located in the C:\Users\<user>\AppData\Local\GitHub\PortableGit_<guid>\binand C:\Users\<user>\AppData\Local\GitHub\PortableGit_<guid>\cmddirectories, add them to the Path variable.

Save your changes and close the page.

gitRun the command in Windows Command Prompt

Open a new command prompt. Type git --versionand press Enter. If you see the version information, the program has been successfully added to the PATH environment variable.

Check git version on cmd

For reprinting, please send an email to 1244347461@qq.com for approval. After obtaining the author's consent, kindly include the source as a link.

Article URL:

Related Articles

Setting Upstream in Git

Publish Date:2025/03/26 Views:151 Category:Git

In this article, we will learn how to use in Git upstream . When using Git by cloning and creating new repositories in branches, we must set up upstream branches for future commits and fetches. But first, we should understand what is upstre

Staging deleted files in Git

Publish Date:2025/03/26 Views:191 Category:Git

This article discusses the necessary steps to stage deleted files in Git. We know that the rm command can delete a file without removing it from the working directory. So, how do we stage the deleted files for commit? Staging deleted files

Git 拉取和 Git 克隆的区别

Publish Date:2024/02/04 Views:223 Category:Git

这篇简短的文章将解决 git clone 和 git pull 的区别。本教程将讨论 git clone 和 git pull 命令之间的区别。

在 Git 中添加空目录

Publish Date:2024/02/04 Views:162 Category:Git

本文深入探讨了将空 git 目录添加到 git 仓库中的方法

如何在 Windows 系统中卸载 git

Publish Date:2023/04/09 Views:878 Category:Git

在这篇简短的文章中,我们将学习如何卸载 Git,以及如何在从个人计算机的目录中卸载 Git 后删除这些文件。

如何检查 Git 的版本

Publish Date:2023/04/09 Views:270 Category:Git

在这篇检查Git最新版本的文章中,我们将学习如何在本地个人计算机或任何服务器上检查Git版本。

Git 如何重命名本地分支

Publish Date:2023/04/09 Views:121 Category:Git

大多数情况下,重命名分支机构是由于上述情况。 因此,在本教程中,我们将学习使用下面提到的技术更改本地 Git 分支的名称。

重命名 Git 存储库中的文件和目录

Publish Date:2023/04/09 Views:191 Category:Git

在本文中,我们将讨论 git 中的重命名过程。 我们使用 Git Rename 来更改工作目录中文件和文件夹的名称。

在 Git 中取消初始化存储库

Publish Date:2023/04/09 Views:365 Category:Git

本本文介绍如何通过 Git 命令行取消初始化 Git 存储库。git init 命令开发一个新的空置 Git 存储库。 它还用于重新初始化已经存在的 Git 存储库。

Scan to Read All Tech Tutorials

Social Media
  • https://www.github.com/onmpw
  • qq:1244347461

Recommended

Tags

Scan the Code
Easier Access Tutorial