-3

I have been trying to install Flutter on Windows 11 and keep on getting stuck on

Error: Unable to find git in your PATH

I have been looking around and kept on trying different ways to get it to recognise the path but nothing seems to work:

  • When installing git I made sure that the installer would add the path variables

  • I added

    C:\Program Files\Git\bin
    C:\Program Files\Git\cmd
    

    to the user paths

  • I also tried to add

    C:\Program Files\Git\bin\git.exe
    

    instead of just the folder (not actually sure which one is the better approach)

But none of this changed anything. I also tried to add

C:\Windows\System32

to the system variables but that gives me the error:

Error: PowerShell executable not found.
       Either pwsh.exe or PowerShell.exe must be in your PATH.

At this point I am out of ideas what else to do, I reinstalled git multiple times and restarted as well, always with the same result. Any help would be greatly appreciated

(also, when I type git --version I get git version 2.35.1.windows.2)

torek
  • 448,244
  • 59
  • 642
  • 775
Another_coder
  • 728
  • 1
  • 9
  • 23
  • Open a DOS Window and do `PATH=C:\Program Files\git\bin;%PATH%` and then try to run `>git --version` does that work? – RiggsFolly Feb 24 '22 at 12:52
  • I also did a clean install and i am having this problem. none of those work either. – chitgoks Mar 18 '23 at 11:56
  • Does this answer your question? [Error: unable to find git in your PATH on windows cmd](https://stackoverflow.com/questions/65446923/error-unable-to-find-git-in-your-path-on-windows-cmd) – Lal Krishna Jun 17 '23 at 07:07
  • Checkout the Answer in: https://stackoverflow.com/a/76495083/4061501 – Lal Krishna Jun 17 '23 at 07:08

4 Answers4

1

I had the same issue, where I was unable to run Flutter commands in my Windows Command Prompt even though I had Flutter and Git installed and updated to PATH in Environment Variables. I could run git --version, but when I issue the command flutter --version it said "unable to find git in PATH" and the terminal crashed.

Here is what solved the problem:

flutter git path

You have to add the git cmd path in the flutter folder i.e C:\src\flutter\bin\mingit\cmd as well as the one in the normal Git folder i.e C:\Program Files\Git\cmd to the System Enviroment Variable PATH.

naiveai
  • 590
  • 2
  • 14
  • 42
iwari
  • 11
  • 2
0

Seems like windows 11 needs to have the path of variables in Variables of Systems not users. So, what I did was to add all the paths that where previously in System variables - users Path to system Path.

Thiago Silva
  • 670
  • 6
  • 18
0

How about adding C:\Windows\System32\WindowsPowerShell\v1.0 to your environment variable "Path"?

It worked out when I added C:\Windows\System32\WindowsPowerShell\v1.0 along with flutter's bin folder, C:\Windows\System32 , C:\Program Files\Git\bin\git.exe, C:\Program Files\Git\cmd.

grey bird
  • 1
  • 1
-1

So this video has helped: https://www.youtube.com/watch?v=3jrmxXtK_0k

I added to my system path variables:

  1. the flutter bin file
  2. C:\Windows\System32
  3. C:\Program Files\Git\bin\git.exe
  4. C:\Program Files\Git\cmd
  5. C:\Windows\System32\WindowsPowerShell\v1.0

once all of those are added flutter does run in the console. I just have no idea it was needed when lots of other tutorials get along without it.

Another_coder
  • 728
  • 1
  • 9
  • 23