错误:未安装“git”命令行工具:

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22153078/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 17:50:10  来源:igfitidea点击:

Error: "git" command line tool is not installed:

git

提问by Phillip Senn

I'm trying to:

我试图:

cordova plugins add https://github.com/wildabeast/BarcodeScanner.git

But I'm getting:

但我得到:

Error: "git" command line tool is not installed:
make sure it is accessible on your PATH.

So then I do this:

那么我这样做:

npm install -g git 

And it looks like it installed it here:

看起来它安装在这里:

c:\Users\Phillip\AppData\Roaming\npm\node_modules\git

So should add that to my existing path?

那么应该将它添加到我现有的路径中吗?

C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;c:\Program Files (x86)\Common Files\Roxio Shared\10.0\DLLShared\;c:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\AdobeAIRSDK\bin;C:\Program Files (x86)\Windows Live\Shared;c:\Program Files\Microsoft SQL Server\110\Tools\Binn\;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;c:\Program Files\Microsoft SQL Server\110\DTS\Binn\;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;c:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\nodejs\;C:\apache-ant\bin;C:\Development\adt-bundle\sdk\platform-tools;C:\Development\adt-bundle\sdk\tools;%JAVA_HOME%\bin;C:\AndroidDevelopmentKit\adt-bundle-windows-x86_64-20131030\sdk\platform-tools;C:\AndroidDevelopmentKit\adt-bundle-windows-x86_64-20131030\sdk\tools

C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem ;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;c:\Program Files (x86)\Common Files\Roxio Shared\10.0\DLLShared\;c:\Program Files (x86)\Common Files\Roxio Shared\DLLShared \;C:\AdobeAIRSDK\bin;C:\Program Files (x86)\Windows Live\Shared;c:\Program Files\Microsoft SQL Server\110\Tools\Binn\;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;c:\Program Files\Microsoft SQL Server\110\DTS\Binn\;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;c :\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;C:\Program Files\Microsoft\Web Platform Installer\;C :\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\nodejs\;C:\apache-ant\bin;C:\Development\adt-bundle\sdk\platform-tools;C:\Development\ adt-bundle\sdk\tools;%JAVA_HOME%\bin;C:\AndroidDevelopmentKit\adt-bundle-windows-x86_64-20131030\sdk\platform-tools;C:\AndroidDevelopmentKit\adt-bundle-windows-x86_64-20131030\ SDK\工具

Or should I add something other than c:\Users\Phillip\AppData\Roaming\npm\node_modules\git? Because I don't see an executable there.

或者我应该添加 c:\Users\Phillip\AppData\Roaming\npm\node_modules\git 以外的内容?因为我在那里没有看到可执行文件。

采纳答案by Atropo

You need to install the gitexecutable. Check how to install it from the Windows section here: git installationor msysgit

您需要安装git可执行文件。在此处检查如何从 Windows 部分安装它:git 安装msysgit

回答by poke

npm install -g git

This will install the NPM package git(also known as node-git). This is not the same as the realGitthat is available as a command line utility. The former NPM package is essentially a Node JS module to utilize Git functionality. And as the project explains, it also contains some actions natively, but for many others it will need to fall back to the command line utility.

这将安装 NPM 包git(也称为node-git)。这与可用作命令行实用程序的真正Git 不同。以前的 NPM 包本质上是一个利用 Git 功能的 Node JS 模块。正如该项目所解释的那样,它还包含一些本机操作,但对于许多其他操作,它需要回退到命令行实用程序。

So, you should just install the real Git.

所以,你应该安装真正的Git

回答by verax

start menu > system properties > system advanced config > environment variables. go to system variables and find "Path" variable, click on "edit" then go to the end of the value, and a semicolon (;) and paste your git route (mine is: C:\Program Files\Git\bin). save it and you're done.

开始菜单 > 系统属性 > 系统高级配置 > 环境变量。转到系统变量并找到“路径”变量,单击“编辑”然后转到值的末尾和分号 (;) 并粘贴您的 git 路由(我的是:C:\Program Files\Git\bin) . 保存它,你就完成了。

回答by Santhosh Legent

if you already install git, still you getting problem means me have two solution 1. add path in EV "C:\Program Files\Git\bin" and "C:\Program Files\Git\cmd". Restart machine.

如果您已经安装了 git,仍然遇到问题意味着我有两个解决方案 1. 在 EV 中添加路径“C:\Program Files\Git\bin”和“C:\Program Files\Git\cmd”。重启机器。

2nd solution is uninstall and install(https://git-scm.com/downloads) aagin and do step1.

第二个解决方案是卸载并安装(https://git-scm.com/downloads)aagin并执行步骤1。

回答by mukta

I also faced same problem and tried all above solutions but still I was getting same issue for that I checked my "Path" in environment variables and found that it was already having (C:\Program Files\Git\cmd;) in Path and i was adding (C:\Program Files\Git\bin;). So it was creating a conflict . Then i removed (C:\Program Files\Git\cmd;) and append (C:\Program Files\Git\bin;) this only in my Path. And close cmd and again type same add plugin command on the same directory and It Worked!!

我也遇到了同样的问题并尝试了上述所有解决方案,但我仍然遇到同样的问题,因为我在环境变量中检查了我的“路径”,发现它已经有 (C:\Program Files\Git\cmd;) 在 Path 和我正在添加 (C:\Program Files\Git\bin;)。所以这是在制造冲突。然后我删除 (C:\Program Files\Git\cmd;) 并将 (C:\Program Files\Git\bin;) 附加到我的路径中。并关闭 cmd 并再次在同一目录中键入相同的 add plugin 命令,它起作用了!!