Repository navigation
Error: Unable to find git in your PATH. on Windows 11 #159018
Description
Steps to reproduce
Download flutter_windows_3.24.5-stable and extract to C:.
Add user environmental PATH variable:
[C:\flutter\bin
]
Moved it up so its the first one as well like the install states.
Have Git-2.47.0.2-64-bit installed. Can use git in cmd and powershell.
I tried everything to resolve this..
(I tried every git path possible...I tried this one along with:
C:\Program Files\Git\bin
C:\Program Files\Git\cmd
C:\flutter\bin\mingit\cmd
C:\flutter\bin\mingit\mingw64\bin\
I downloaded the most up to date git windows 64 bit version (2.42) and everything seems to be fine.
When running the git rev-parse HEAD:
PS C:\flutter> git rev-parse HEAD
dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668
Running where flutter:
[C:\flutter\bin\flutter
C:\flutter\bin\flutter.bat]
For my User's windows path environment variable, it includes:
flutter bin, git paths.
Actual results
When opening via command line and running "flutter", "flutter -v", "flutter doctor", "flutter.bat doctor", all results in the same error message:
Error: Unable to find git in your PATH
Logs
Logs
<!-- Paste your logs here -->
Flutter Doctor output
Error: Unable to find git in your PATH
Activity
cesarsiuu2316 commentedon Nov 17, 2024
I'm having the same problem.
I also tried adding all folders as safe directories in the git config as follows:
git config --global --add safe.directory '*'Yet, the error remains present.
Maybe that helps.
atang08 commentedon Nov 17, 2024
I also tried that to no avail. I even ran the command and restarted just for the heck of it and it still does it.
I even tried it without the ‘’.
git config --global --add safe.directory *I am starting to think this has nothing to do with git but instead flutter not being able to spit out a more specific error message.
I already gave up after hours and days wasted and what stinks is I wanted to start learning flutter because the dev community says its much a better dev experience than react native but now I am about to just forget flutter and jump on the react bandwagon
cesarsiuu2316 commentedon Nov 17, 2024
Hey I managed to resolved it.
I found the solution in this stack overflow response: stack overflow Hope it helps.
It seems to be a very weird error involving the folder in which the cmd opens.
atang08 commentedon Nov 17, 2024
Bless you! I tried everything but that solution and it worked!
So basically the command processor can't have any AutoRun key registered in windows. I had one because usually I like the command prompt to be inside the current project folder I'm working on and not have to type "cd C:\project\current_project" everytime when opening.
I wonder if flutter can fix this so people with a autorun key in their windows registry can still run smoothly.
cesarsiuu2316 commentedon Nov 17, 2024
Me too, spent hours trying everything, bless the guy that found the solution too. You're welcome, btw haha. I hope that they can fix that as well, I also like the AutoRun key.
huycozy commentedon Nov 18, 2024
huycozy commentedon Nov 18, 2024
I don't encounter this issue on my Windows 11. I just saw @atang08's response at #156922 (comment) with the required information (sorry somehow I missed it), so I quote it here for further insight as that issue has been closed by OP:
@cesarsiuu2316: Thank you for sharing SO answer, that may be helpful to investigate this.
bkonyi commentedon Nov 18, 2024
Thanks for the details everyone, that's very helpful! Were you all able to fix the issue by clearing
Computer\HKEY_LOCAL_MACHINE\Software\Microsoft\Command ProcessororComputer\ HKEY_CURRENT_USER\Software\Microsoft\Command Processor?If so, I think this should be a relatively simple fix if we just immediately change the current directory in the script to the directory the
flutter.batscript lives as soon as it's invoked and before running any commands.cesarsiuu2316 commentedon Nov 24, 2024
In my case @bkonyi , I was able to fix the issue by clearing
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor.Hope this helps, thanks for the follow up.
[ Tool ] Fix "Error: Unable to find git in your PATH" when Command Pr…
bkonyi commentedon Nov 25, 2024
Yep, this is super helpful! I should have a fix for this in #159424.
[ Tool ] Fix "Error: Unable to find git in your PATH" when Command Pr…
github-actions commentedon Dec 17, 2024
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.