3

I've just tried to install Flutter on windows 10. When I try to run a flutter command (flutter doctor), I'm getting

Error: Unable to find git in your PATH.

I have set the path to both git and flutter and tried adding the following to path

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

How can I resolve this???

Simeon
  • 808
  • 1
  • 11
  • 31

5 Answers5

3

Go to my flutter installation folder and inside flutter/bin edit the flutter.bat file using a text editor and remove the line (Line 33 in mine) that says

IF EXIST "%mingit_path%" SET PATH=%PATH%;%mingit_path%

The code should look like this on those lines

REM If available, add location of bundled mingit to PATH 
SET mingit_path=%FLUTTER_ROOT%\bin\mingit\cmd

REM Test if Git is available on the Host
where /q git || ECHO Error: Unable to find git in your PATH. && EXIT /B 1

Save and Run flutter doctor and everything should work fine.

I guess its something to do with the path variables being confused.

1

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?

Simeon
  • 808
  • 1
  • 11
  • 31
1

Find the flutter.bat in your flutter folder which should be inside flutter/bin and edit the flutter.bat using your text editor.

Remove the below line from the file (Mine was Line 33)

IF EXIST "%mingit_path%" SET PATH=%PATH%;%mingit_path%

The file should look like this after you remove it

REM If available, add location of bundled mingit to PATH 
SET mingit_path=%FLUTTER_ROOT%\bin\mingit\cmd

Save and Run flutter doctor and everything should work fine.

I guess its something to do with the path variables being confused.

Before

After

0

Set the path up to bin

 C:\Program Files\Git\bin

then try

git --version

if still not working, reinstall git

check these two threads for the further issues SO GH

Ajay Tom George
  • 1,357
  • 1
  • 10
  • 22
0

It turns out I didn't have git installed

https://git-scm.com/downloads

https://git-scm.com/downloads

MosesAyo
  • 125
  • 8