我已经安装了Git for Windows,但是当我尝试在命令提示符中使用Git命令时,我得到以下错误:
'git' is not recognized as an internal or external command,
operable program or batch file.
我如何解决这个问题?
我已经安装了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并选择正确的选项。
其他回答
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
这对我很有帮助: 我设置 C:\Program Files (x86)\Git\cmd 环境变量的路径。
如果你使用的是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/菜单。祝你好运。
;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd
在环境变量中添加上述路径
注意:路径可能不同,但你应该同时添加bin和CMD
我遇到过这个问题,在安装Git后解决了 Downloadlink: https://git-scm.com/downloads