Add Git to PATH on Windows
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 git
addPATH
The Git executables are located in C:\Program Files\Git\bin\git.exe
and C:\Program Files\Git\cmd
. These directories must be added to PATH
the 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 variables
navigate there by typing in the search box and clicking on the best match.
Another method is as follows.
-
Scroll and tap
高级系统设置
.
Edit the environment variables to add the value to PATH
the variable
Click Add value to 系统属性
under .环境变量
PATH
Select 系统变量
the 路径
and click 编辑
the button.
Click New
the button and add C:\Program Files\Git\cmd
the value. Save it and C:\Program Files\Git\bin\git.exe
repeat the same process for .
If your executables 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 your changes and close the page.
git
Run the command
in Windows Command Prompt
Open a new command prompt. Type git --version
and press Enter. If you see the version information, the program has been successfully added to the PATH environment variable.
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.
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 命令之间的区别。
如何在 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 存储库。