我已经安装了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。
在此下载:
https://git-scm.com/downloads
安装它。
如果您使用的是Windows,现在将看到一个C:\Program Files\Git文件夹。
打开一个新的命令提示符窗口,并尝试再次运行git命令。
其他回答
安装git之前打开cmd提示符了吗?如果是,请关闭并重新打开。
您是否正确地设置了指向Git安装的PATH ?
需要在“PATH”中添加如下路径:
C:\Program Files\Git\bin\ C:\Program Files\Git\cmd\
检查这些路径是否正确——你可能把Git安装在不同的驱动器上,或者在Program Files (x86)下。如有必要,请修改路径。
Windows 10操作系统下修改PATH:
在开始菜单或任务栏搜索中,搜索“环境变量”。 选择“编辑系统环境变量”。 点击底部的“环境变量”按钮。 双击“系统变量”下的“路径”条目。 使用PATH编辑器中的“New”按钮,将C:\Program Files\Git\bin\和C:\Program Files\Git\cmd\添加到列表的末尾。 关闭并重新打开控制台。
Windows 7操作系统下修改PATH:
在桌面或开始菜单上右键单击“计算机”。 选择“属性”。 在最左边,点击“高级系统设置”链接。 点击底部的“环境变量”按钮。 双击“系统变量”下的“路径”条目。 在“变量值”的末尾,插入一个;C:\Program Files\Git\cmd\。中间不要留有空隙;这是分量。 关闭并重新打开控制台。
如果这些说明没有帮助,请随意查看其他一些说明:
如何在Windows中设置路径和环境变量(计算机希望) 如何编辑您的系统路径,以便在Windows命令行访问(How- to Geek) 如何在Windows 10中设置Path环境变量(上瘾提示) 什么是PATH和其他环境变量,如何设置或使用它们?(超级用户)
Windows 7 32位
我正在为我的Ruby on Rails应用程序使用git。第一次,所以…
我创建了一个.bat文件,用于加载使用本教程手动输入的路径的RoR应用程序,地址是“http://www.youtube.com/watch?v=-eFwV8lRu1w”。如果你是Ruby on Rails的新手,你可能想要检查一下,因为我遵循了所有步骤,经过几次试验和错误后,它完美地工作了。
(.bat文件是可以使用notepad++编辑的,因此不需要长时间的过程,当你需要编辑路径时,你可以在创建一个.bat文件后,按照“文件称为row.bat”上方链接上的教程遵循这些简单的过程。)
right click on the .bat file, edit with notepad++. find path. insert path below the last path you inputted. ) During the tutorials I don't remember anything said in regards to using the git command so when starting a new project I had this same problem after installing git. The main issue I had was locating the folder with the bin/git.exe (git.exe did not show up in search using start menu's "search programs and files" ) NOTE I now understood that the location might vary drastically --- see below.
要定位bin/git.exe,我遵循以下步骤
1左键单击开始菜单,找到->>所有程序->> GitHub inc.。 2 .右键单击git shell,选择打开文件位置 3 .点击穿过文件夹的文件位置,找到文件夹“bin”
(我有4个文件夹命名为 1. IgnoreTemplates_fdbf2020839cde135ff9dbed7d503f8e03fa3ab4 2. lfs-x86_0.5.1 3.PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad ("bin/exe,在这里找到<<-") 4. PoshGit_869d4c5159797755bc04749db47b166136e59132 )
复制完整的链接点击探索者的url (我的是“C:\Users\username\AppData\Local\GitHub\PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad\bin”)在notepad++中打开。bat文件,并使用上面教程中关于如何添加路径到你的。bat文件的说明进行粘贴。问题解决了!
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的位置。 如果它不工作,尝试重新启动命令提示符,使其读取 更新的环境变量。 如果它仍然不工作,尝试重新启动你的机器强制命令 提示读取更新的环境变量。