问题
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