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

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

我如何解决这个问题?


当前回答

这是因为在安装时,您已经选择了默认单选按钮,只使用“Git”和“Git bash”。如果你选择“Git和命令行工具”,这就不是问题了。

解决方案#1:因为你已经安装了Git工具,现在导航到所需的文件夹,然后右键单击并使用“Git bash here”运行相同的命令,它将正常运行。 解决方案#2:尝试重新安装Git-scm并选择正确的选项。

其他回答

;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd

在环境变量中添加上述路径

注意:路径可能不同,但你应该同时添加bin和CMD

开始->所有程序->Git->Git Bash

带你直接到Git Shell。

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

在此下载:

https://git-scm.com/downloads

安装它。

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

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

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

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