3

Whenever I run the flutter or dart commands on the command line or PowerShell I get "Error: Unable to find Git in your PATH".

I've already tried to the solutions from other suggestions like making sure the PATH contains:

  1. C:\Windows\System32
  2. C:\Windows\System32\WindowsPowerShell\v1.0
  3. C:\Program Files\Git\bin and/or C:\Program Files\Git\bin\git.exe
  4. C:\Program Files\Git\cmd
  5. C:\src\flutter\bin

I reinstalled flutter and still does the same.

I reinstalled Git and tried it on the command line and Git works.

I'm using VS Code and Windows 11, any suggestions?

enter image description here

5
  • 1
    C:\Program Files\Git\bin\git.exe PATH must be a list of directories, not files! Commented Apr 1, 2023 at 14:49
  • 1
    @phd Yes, I know the PATH is an environment variable which contains a string of text holding a list of directories separated by semicolons and are not files, however I wanted to try C:\Program Files\Git\bin\git.exe because I've seen it like that in other suggestions, I did get rid of it afterwards. Commented Apr 1, 2023 at 14:59
  • What does Get-Command git -All report in your VS Code PowerShell session? Does $env:Path report a different value than path in cmd.exe? Commented Apr 1, 2023 at 20:30
  • @mklement0 Check the image I added, you'll see to see the response to your questions... $env:Path and %path% have the same value. Commented Apr 2, 2023 at 19:56
  • Mysterious - I'm out of ideas. This answer offers methodical troubleshooting tips, but I'm not sure it has something to offer that you haven't already tried. Commented Apr 2, 2023 at 20:39

1 Answer 1

0

I had this problem. Adding paths to Path(System variables):

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

helped solve the problem.

-> Also, try rebooting the computer for the changes to take effect

-> Run cmd/PowerShell/Android Studio as administrator

Moreover, I use the git portable version.

Sign up to request clarification or add additional context in comments.

3 Comments

@Ruble I've already added the paths to PATH... I use VS Code... I'm running the flutter and dart commands from VS Code and from the command line and/or powershell... I rebooted the computer and still get the error... You use the portable version of what?
@phd Yes, I know the PATH holds a list of directories not files.
It was meant that the git is installed portable...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.