我已经安装了Git for Windows,但是当我尝试在命令提示符中使用Git命令时,我得到以下错误:

'git' is not recognized as an internal or external command,
operable program or batch file. 

我如何解决这个问题?


当前回答

避免搅乱PATH变量的简单方法:重新安装git并选择“从Windows命令提示符使用git”。如前所述,它将为您使用PATH变量。看到截图

其他回答

Go to My Computer => Local Disk(C:) => Program Files(x86) => Git => cmd Right Click the git => Select Properties Under the location Copy the text eg - C:\Program Files (x86)\Git\cmd Come back to the Desktop Right-click My Computer Select property Open Advanced Click Environment Variables In the System variables Find the Variable call Path Click the variable Click the Edit Button Select the Variable value Text Box . Go to the edge of the text and put semicolon(;) Then Right-click and press Paste Press Ok

哟!我在这方面有很多问题。似乎Github带来了自己的控制台,你需要在你的驱动器中寻找。我最终通过以下方法运行了它:

按下开始键。 搜索“GitHub”(不带引号) 右键点击“GitHub”,选择“打开文件位置”

*这将打开*

C:\Users\UserName\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\GitHub, Inc

username是你电脑的用户名

找一个叫“Git Shell”的程序。双击它。

这将打开一个PowerShell命令提示符。然后你就可以在上面正常运行git命令了。

我遇到过这个问题,在安装Git后解决了 Downloadlink: https://git-scm.com/downloads

确保正确的git路径添加到路径变量 环境变量。例如- C:\Program Files C:\Program Files (x86)\Git\cmd。它可以是不同的 具体情况取决于安装git的位置。 如果它不工作,尝试重新启动命令提示符,使其读取 更新的环境变量。 如果它仍然不工作,尝试重新启动你的机器强制命令 提示读取更新的环境变量。

如果你得到这个错误,你可能没有在你的系统中安装git。

在此下载:

https://git-scm.com/downloads

安装它。

如果您使用的是Windows,现在将看到一个C:\Program Files\Git文件夹。

打开一个新的命令提示符窗口,并尝试再次运行git命令。