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

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

我如何解决这个问题?


当前回答

这对我很有帮助: 我设置 C:\Program Files (x86)\Git\cmd 环境变量的路径。

其他回答

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

安装git之前打开cmd提示符了吗?如果是,请关闭并重新打开。

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

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

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

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

如果你使用的是Windows 10,请这样做:

Go to Start Start typing 'This PC' Right-click This PC, choose Properties On the left side of the window that pops up, click on Advanced System Settings Click on the Advanced tab Click on the Environmental Variables button at the bottom Down in the System Variables section, double-click Path Click the New button in the top right corner Add this path: C:\Program Files\Git\bin\ then click the enter key Add another path: C:\Program Files\Git\cmd Close & re-open the console if it's already open.

我带你经历了漫长的过程,让你接触到不同的Windows/菜单。祝你好运。