在您的 PATH 环境变量中找不到 Git - Windows

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17120625/
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-19 08:38:35  来源:igfitidea点击:

Could not find Git in your PATH environment variable - Windows

gitwindows-8

提问by PositiveGuy

I'm running windows 8 and ran the setup for the Git credential helper found here: http://blob.andrewnurse.net/gitcredentialwinstore/git-credential-winstore.exe

我正在运行 Windows 8 并运行此处找到的 Git 凭据帮助程序的设置:http: //blob.andrewnurse.net/gitcredentialwinstore/git-credential-winstore.exe

When it runs, in the console window that pops up, I get "Could not find Git in your PATH environment variable. You can specify the exact path to git by running git-credential-winstore -i C:\Path\To\Git.exe"

当它运行时,在弹出的控制台窗口中,我得到“在你的 PATH 环境变量中找不到 Git。你可以通过运行 git-credential-winstore -i C:\Path\To\Git 来指定 git 的确切路径。可执行程序”

I guess I do not know enough about windows here to understand what I should do here. Ok WHERE do I type this git-credential-winstore -i C:\Path\To\Git.exe, in the GitBash console?

我想我对这里的 windows 了解不够,无法理解我应该在这里做什么。好的,我在哪里输入这个 git-credential-winstore -i C:\Path\To\Git.exe,在 GitBash 控制台中?

The path to my Git.exe appears to be C:\Program Files (x86)\Git\cmd

我的 Git.exe 的路径似乎是 C:\Program Files (x86)\Git\cmd

Also note that when I installed Git from http://git-scm.com/downloadsfor windows, I chose the option "Use Git Bash Only" as I'm not really familiar with any of this stuff period.

另请注意,当我从http://git-scm.com/downloads为 windows安装 Git 时,我选择了“仅使用 Git Bash”选项,因为我对这些东西并不熟悉。

UPDATE- more details

更新- 更多细节

I am referencing this blog post: http://www.jeremymorgan.com/tutorials/how-to-install-octopress-windows/

我参考了这篇博文:http: //www.jeremymorgan.com/tutorials/how-to-install-octopress-windows/

So the problem is even after I tried the command "Yari 1.9.3" in the command prompt for windows, or in powershell, neither worked:

因此,即使我在 Windows 的命令提示符或 powershell 中尝试了“Yari 1.9.3”命令后,问题仍然存在,但都没有奏效:

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

回答by CraicerHyman

you cd into your download directory or wherever you saved git-credential-winstore.exe to:

您 cd 进入您的下载目录或您将 git-credential-winstore.exe 保存到的任何位置:

C:\Users\user\Downloads>

then run

然后运行

 git-credential-winstore -i "C:\Program Files (x86)\Git\bin\git.exe"

your windows command line will look like this:

您的 Windows 命令行将如下所示:

C:\Users\user\Downloads>git-credential-winstore -i "C:\Program Files (x86)\Git\bin\git.exe"

note the quote marks.

注意引号。

This worked for me.

这对我有用。

回答by Steven Penny

You run commands like this from a shell

从 shell运行这样的命令

With Windows the defacto shell is cmd.exe, also known as Command Prompt.

在 Windows 中,事实上的 shell 是cmd.exe,也称为 命令提示符

This "program" can typically be found at C:\Windows\System32\cmd.exe

这个“程序”通常可以在 C:\Windows\System32\cmd.exe

Your instructions likely omit this information because cmd.exehas been around for 20 years.

您的说明可能会忽略此信息,因为cmd.exe已经存在 20 年了。

回答by Kim Ki Won

You can only install path under uninstall registry key.
some snippet batch script.

您只能在卸载注册表项下安装路径。
一些片段批处理脚本。

@ECHO OFF

SET __PA=

IF /i NOT "%PROCESSOR_ARCHITECTURE%"=="x86" SET __PA=\Wow6432Node
FOR /F "tokens=2*" %%F in ('REG QUERY HKLM\SOFTWARE%__PA%\Microsoft\Windows\CurrentVersion\Uninstall\Git_is1 /v InstallLocation') DO SET gitPath=%%G

ECHO %gitPath%

回答by Dynamic Remo

Because the git you have installed is not in the Program Files or Program Files(x86).

因为您安装的 git 不在 Program Files 或 Program Files(x86) 中。

It have been installed as a localized version for the particular user and thus your Environment Variable path should be like this. C:\Users\\AppData\Local\Programs\Git\bin

它已作为特定用户的本地化版本安装,因此您的环境变量路径应该是这样的。C:\Users\\AppData\Local\Programs\Git\bin

Cheers ;)

干杯;)

回答by Hussein Samir

if you use win7 you should update your path , right click on my computer , advanced system setting , environment variables , in below choose path , and put (;) semi colom , then add bin folder in flutter sdk direction , it will be run

如果你用的是win7你应该更新你的路径,右键单击我的电脑,高级系统设置,环境变量,在下面选择路径,并输入(;)分号,然后在flutter sdk方向添加bin文件夹,它将运行