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

半世苍凉 提交于 2021-02-04 16:44:34

问题


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

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

Error: Unable to find git in your PATH.

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

things I've done:

  • included all essential git paths i.e.

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 )

  • checked flutter bin path

  • tried running cmd as administrator

  • tried running command in flutter console

None of the above worked as the error still prevails.

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 .


回答1:


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

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%

By adding:

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

The OP confirms in the chat that it is working.



来源:https://stackoverflow.com/questions/62132199/how-to-fix-unable-to-find-git-in-your-path-error-despite-providing-required

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!