1

I just installed Flutter SDK, And I got an error Error: Unable to find git in your PATH. when I type flutter --version in CMD.

I searched about this and I found some answers, but nothing works.

I installed SDK in D:, so I deleted it and installed it in C:\src, and I set System variable again, but still same.
And I installed Git and tried again, but failed.

I'm using Window 10.

Superjay
  • 447
  • 1
  • 7
  • 25
  • 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:06

3 Answers3

3

Add path of installed git usually it is in following path,check once,the update the path

C:\Program Files\Git\cmd

to your PATH variable

After you added path,still have problem try this

You could try reinstalling Git with "Use Git and optional unix tools from the command prompt" selected in the installer.

This would add git and the unix tools to the path. You may have installed with only 'Use Git from Bash only' selected?

Abhijith
  • 2,227
  • 2
  • 15
  • 39
  • Can I install Git and Flutter in D:? It doesn't matter? – Superjay Jan 12 '21 at 06:46
  • I am not sure,i have installed flutter in my D drive and i have installed git on default path,i have no problem using it is working perfectly,uninstall the git then install it again and update the path @JayLee – Abhijith Jan 12 '21 at 06:49
  • after installation and added path run `git --version` to check if it can access globally@JayLee – Abhijith Jan 12 '21 at 06:52
  • I installed git, but you mean I have to add 3 path in PATH variable? (git.exe, cmd, System32) – Superjay Jan 12 '21 at 07:09
  • Not necessary but you can just add just above path only not the three path sorry about that@JayLee – Abhijith Jan 12 '21 at 07:14
  • Oh! It works perfectly! I installed Flutter and Git in D drive, and it works very well. Thank you! – Superjay Jan 12 '21 at 07:14
  • It's all about setting path correctly,glad it worked for you@JayLee – Abhijith Jan 12 '21 at 07:17
  • Sadly this doesn't work for me. I can type 'git' from cmd and it works so I know the path is set correctly. But Flutter still can't seem to find it. – Badrul Apr 03 '23 at 07:17
0

I was having everything set correctly but I was still facing the error I only had to reopen Android Studio as Administration.. I hope this works for anyone

-1

How to Solve “Unable to find git in your PATH” On Flutter?

You need to install Git using the below command line

winget install --id Git.Git -e --source winget

Add this to your PATH variable

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

Do not create a new variable for git but add them as I did one after another separating them by ";"

If you are windows, 10 users. we’ve tried everything but running cmd as Administrator solved my problem. This may be helpful for others.

You can also try by uninstalling and reinstall GIT to solve my problem. You can download 64-bit GIT for windows setup: https://git-scm.com/download/win

FOR WINDOWS: If you chose visual studio code during git installation and have multiple user accounts on windows then all you need to do is uninstall git and reinstall git choosing vim as the default editor, not visual studio code.

You also get a warning when choosing visual studio code during git installation.

Pay attention to that,
For me setting visual studio code as default and having multiple User accounts was the issue.

Thanks FlutterAgency.com for this help. https://flutteragency.com/unable-to-find-git-in-your-path/

K D
  • 205
  • 3
  • 10