我已经安装了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
哟!我在这方面有很多问题。似乎Github带来了自己的控制台,你需要在你的驱动器中寻找。我最终通过以下方法运行了它:
按下开始键。 搜索“GitHub”(不带引号) 右键点击“GitHub”,选择“打开文件位置”
*这将打开*
C:\Users\UserName\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\GitHub, Inc
username是你电脑的用户名
找一个叫“Git Shell”的程序。双击它。
这将打开一个PowerShell命令提示符。然后你就可以在上面正常运行git命令了。
安装完成后,打开GitHub应用程序,在右上角你会注意到一个设置图标。从下拉菜单中选择“选项”,并选择“默认Shell”作为Cmd。
现在尝试在搜索中输入'git shell' (windows键和类型)并选择git shell。它应该在CMD中打开,git现在应该被识别。
检查Bit Locker是否已启用!我遇到了类似的问题,我的GIT在cmd中工作正常。但是在快速重启后,它不起作用,我得到了如上所述的错误。
所以我必须解锁比特锁,因为我已经在硬盘卷(:E)中安装了GIT,这是由比特锁加密的。
;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd
在环境变量中添加上述路径
注意:路径可能不同,但你应该同时添加bin和CMD