如何修复“无法在您的路径中找到Git"错误,尽管提供了必需的路径 [英] How to fix "unable to find Git in your path " error , despite providing required path

查看:76
本文介绍了如何修复“无法在您的路径中找到Git"错误,尽管提供了必需的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我尝试运行flutter命令(以cmd为单位)时,就会发生以下错误:

Whenever i try to run a flutter command (in cmd), the following error occurs :

'where'不被识别为内部或外部命令,可操作的程序或批处理文件.

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

错误:在您的PATH中找不到git.

Error: Unable to find git in your PATH.

我在这里发现了类似的错误如何解决在PATH中找不到git"在Flutter上?并尝试了一切

I found the similar error here How to solve "Unable to find git in your PATH" on Flutter? and tried everything

我所做的事情:

  • 包括了所有必不可少的git路径,即

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

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

  • (多次执行上述步骤,重新启动计算机,然后重试=失败)

    • (did the above step many times , restarted computer and tried again = fail )

      检查的颤振仓路径

      尝试以管理员身份运行cmd

      tried running cmd as administrator

      在flutter控制台中尝试运行命令

      tried running command in flutter console

      由于错误仍然存​​在,上述方法均无效.

      None of the above worked as the error still prevails.

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

      EDIT : I uninstalled Git completely , then reinstalled it (choosing the right options) , checked environment variables and everything , gave the flutter command in cmd , and it still shows the same error! I don't know what to do now .

      推荐答案

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

      A path should not include git.exe, only its parent folder.

      如果简化了PATH,请参见我的示例:

      See my example if simplified PATH:

      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在聊天中确认 正常.

      The OP confirms in the chat that it is working.

      这篇关于如何修复“无法在您的路径中找到Git"错误,尽管提供了必需的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆