0

I have followed all steps and added C:\flutter\bin;C:\Program Files\Git\git-cmd.exe;C:\Windows\System32 to my path but still get the error unable to find git in your PATH after trying to run flutter doctor.

I have also reinstall Git and adjusted my PATH environment to use Use Git and optional Unix tools from the command prompt but I still get same error when trying to run flutter doctor

aily
  • 49
  • 1
  • 1
  • 6

3 Answers3

8

I've got this problem too when running flutter doctor on vs code cmd's, if you think you've added the correct PATH (How to solve "Unable to find git in your PATH" on Flutter?) and still get the error, try to run git config --global --add safe.directory C:/flutter. C:/flutter should be the directory of flutter that you use

3

Instead of C:\Program Files\Git\git-cmd.exe, you should add C:\Program Files\Git\cmd to PATH.

When we type git and enter in cmd.exe, we actually run C:\Program Files\Git\cmd\git.exe.

C:\Program Files\Git\git-cmd.exe is a command line program that will initialize PATH and do other stuff. You still need to type git (short for C:\Program Files\Git\cmd\git.exe) to run git in git-cmd.exe.

lyh543
  • 847
  • 6
  • 8
0

In my case, I have installed new version from Git official website. (Git-2.41.0).

But the flutter has a git with different version: 2.15.1.windows.2.1.g603511c649. Maybe that could be the reason.

Steps I followed to solve my issue:

  • Run command: where git. This will list out all the existing git paths.
  • Remove all git entries except C:\flutter\bin\mingit\cmd from Environment Path variable. (If you don't have this variable, add it.).
Lal Krishna
  • 15,485
  • 6
  • 64
  • 84