1

I created a new user on my windows PC and can't get flutter to work on it. Flutter and git are both installed in a shared folder (like C:\shared_programs\...). I made sure that both users have full access in the security properties of that folder.

I added all these to the System Path Variable:

  • C:\shared_programs\flutter\bin
  • C:\Windows\System32
  • C:\shared_programs\Git\cmd

When I run where git or where flutter, the correct paths are printed.

But when I run flutter, it returns "Error: Unable to find git in your PATH." Why? How do I fix this?

(I think this question is not a duplicate because this question was fixed by adding something to the path which I already did, and this question is about the where command not working, which isn't my problem. And this one also doesn't work for me.)

Finni
  • 429
  • 5
  • 17
  • Is this only a problem for the new user? Or is it a problem for all the existing users too? – merlin2011 Feb 03 '23 at 02:41
  • I installed fvm with cmd, but IntelliJ was using powershell. Running `git rev-parse HEAD` in the flutter location through powershell failed ('folder' is owned by xyz but the current user is abc). By calling the following command in powershell this fixed it for me `git config --global --add safe.directory C:/path_to_fvm_home/versions/3.7.0` – jdepypere Feb 03 '23 at 10:36
  • @merlin2011 only for the new user – Finni Feb 03 '23 at 13:14
  • @jdepypere thank you! That fixed it for me. If you post this as an answer, I will accept it (it didn't have anything to do with powershell/cmd for me tho, IntelliJ used cmd for me) – Finni Feb 03 '23 at 13:18

1 Answers1

3

I had a similar problem and your post incited me to investigate it further.

Fvm had installed flutter 3.7.0 through cmd. Using cmd I could also successfully run git rev-parse HEAD in the flutter sdk folder.

It seems however that executing the same command through powershell didn't work (and IntelliJ uses powershell for me).

By calling the following command in powershell this fixed it for me: git config --global --add safe.directory C:/path_to_fvm_home/versions/3.7.0

jdepypere
  • 3,453
  • 6
  • 54
  • 84
  • I installed flutter through cmd and running `git rev-parse HEAD` in cmd in the flutter directory returned `fatal: detected dubious ownership in repository at ...`, and running `git config --global --add safe.directory C:\path\to\flutter` fixed it. A little different from your issue, but thank you nonetheless – Finni Feb 03 '23 at 13:52