如何修复 "unable to find Git in your path " 错误,尽管提供了所需的路径

How to fix "unable to find Git in your path " error , despite providing required path

每当我尝试 运行 flutter 命令(在 cmd 中)时,都会发生以下错误:

'where' is not recognized as an internal or external command, operable program or batch file.

Error: Unable to find git in your PATH.

我在这里发现了类似的错误 并尝试了一切

我做过的事情:

C:\Program Files\Git\bin\git.exe;C:\Program Files\Git\cmd;C:\Windows\System32

上面的

None 有效,因为错误仍然存​​在。

编辑:我完全卸载了 Git,然后重新安装(选择正确的选项),检查了环境变量和所有内容,在 cmd 中给出了 flutter 命令,它仍然显示相同的错误!我现在不知道怎么办。

路径不应包含 git.exe,仅包含其父文件夹。

如果简化路径,请参阅我的示例:

set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
set GH=C:\path\to\git
set PATH=%GH%\bin;%GH%\usr\bin;%GH%\mingw64\bin;%PATH%

通过添加:

set PATH=C:\Flutter\flutter\bin;%PATH%

OP 确认in the chat它正在工作。