1

I have git set in my PATH variables, but it shows the response "unable to find git in PATH". However, when I run "flutter doctor" in admin mode, it doesn't display that "unable to find git in PATH" message. It actually shows the flutter doctor command functioning.

PATH:

C:\Program Files\Git\cmd

C:\Program Files\Git\bin

C:\Windows\System32

None of these PATHs fixed the issue. I just want to be able to run the flutter command outside of admin mode.

kivisto
  • 11
  • 2
  • Normal users do not have write access to those folders. If you want normal users to be able to run your code than you have to create a shortcut and add the property to shortcut Run As Admin. – jdweng Mar 05 '23 at 08:52
  • @jdweng, the question is about missing directories from `$env:Path`, resulting in the inability to _locate an executable_ by name only (`git`); it isn't about wanting to _write to_ those directories. – mklement0 Mar 05 '23 at 15:52
  • I've scoured the internet. No one knows. So I've raised the issue on the Flutter issues page: https://github.com/flutter/flutter/issues/123995. Honestly I feel like I'm always the one to stumble across issues to do with basic usage whenever I try any programming tech. I should just get hired as a tester for everything given my luck. – Badrul Apr 03 '23 at 07:49

2 Answers2

0

If you're running your elevated (admin) sessions with your own user identity, you should see the same $env:PATH value (value of the Path environment variable) in your non-elevated sessions too.

Conceivably, you simply haven't yet started a new non-elevated session since the registry-based persistent definition of the Path environment variable was modified (such changes are never picked up in-session).

Therefore:

  • Start a new (non-elevated) PowerShell session via the taskbar or the Start Menu.

  • If that doesn't help, log off and log back in, or forcefully kill all Windows (GUI) shell processes with Stop-Process -Force -Name explorer before starting a new session.

A comprehensive troubleshooting guide for $env:PATH issues can be found in this answer.

mklement0
  • 382,024
  • 64
  • 607
  • 775
0

I am facing the same issue even after setting the paths. I tried this code. Try to run this command on your cmd panel

git config --global --add safe.directory '*'

Hope it works, Thank you

Ale
  • 917
  • 9
  • 28
Ravitez
  • 1
  • 2