我已经安装了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.
我如何解决这个问题?
当前回答
;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd
在环境变量中添加上述路径
注意:路径可能不同,但你应该同时添加bin和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路径添加到路径变量 环境变量。例如- C:\Program Files C:\Program Files (x86)\Git\cmd。它可以是不同的 具体情况取决于安装git的位置。 如果它不工作,尝试重新启动命令提示符,使其读取 更新的环境变量。 如果它仍然不工作,尝试重新启动你的机器强制命令 提示读取更新的环境变量。
如果你得到这个错误,你可能没有在你的系统中安装git。
在此下载:
https://git-scm.com/downloads
安装它。
如果您使用的是Windows,现在将看到一个C:\Program Files\Git文件夹。
打开一个新的命令提示符窗口,并尝试再次运行git命令。
如果你想设置为临时用途,只需执行下面的命令。
打开命令提示符< run——> CMD > . CMD 执行以下命令。 设置路径=C:\程序文件\Git\bin 输入git,就可以了。
这是有效的当前窗口/单元格,如果你将关闭命令提示符,一切都将消失。 为了永久设置,在环境变量中设置GIT。
a.按窗口+暂停键 b.单击“高级系统设置”。
c.单击“高级选项卡”下的“环境变量”。
d.编辑“路径变量”。
e.在语句末尾添加以下行。 Git; c: \ Program Files \ \ bin。
f.按“OK”!! g.打开新的命令提示符。 h.输入“git”,按“Enter”
谢谢
避免搅乱PATH变量的简单方法:重新安装git并选择“从Windows命令提示符使用git”。如前所述,它将为您使用PATH变量。看到截图