5

I just updated Visual Studio Code to v.1.19.0 and suddenly Git is not recognized. I can still perform everything from the terminal (cmd) window, but the Source Control tab is empty and I get:

Git not found. Install it or configure it using 'git.path' setting"

This is what I see in the Output console:

Looking for git in: C:\Users\UserName\AppData\Local\Programs\Git\cmd
Looking for git in: C:\Program Files\Git\cmd\git.exe
Looking for git in: C:\Program Files (x86)\Git\cmd\git.exe
Looking for git in: C:\Program Files\Git\cmd\git.exe

In my settings I have:

"git.path": "C:\\Users\\UserName\\AppData\\Local\\Programs\\Git\\cmd"

which points to the location of git.exe

I am not sure why, but when I installed Git it placed it in the AppData folder instead of in Program Files. Regardless, everything was working fine until this morning when I installed the update.

If it helps, I am on a Windows machine with Windows 10 64-bit OS and Git version 2.15.1.windows.2.

Why is Visual Studio Code not seeing it?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
dpdragnev
  • 2,011
  • 2
  • 28
  • 55
  • What is the location of git? maybe you just need \\ on the end of the path – jamesc Dec 16 '17 at 21:17
  • You were on the right path, but this did not work. I had to add git.exe at the end of the path as VonC suggested below. – dpdragnev Dec 16 '17 at 21:26
  • Likely canonical (2015, 36 answers, and 221 votes): *[Visual Studio Code cannot detect installed Git](https://stackoverflow.com/q/29971624/)*. – Peter Mortensen Dec 17 '22 at 01:58

1 Answers1

4

2017: Try setting git.exe instead of the parent folder:

"git.path": "C:\\Users\\UserName\\AppData\\Local\\Programs\\Git\\cmd\\git.exe"

This is what I needed in my own VSCode User settings:

user settings for git.exe


More recently, VSCode 1.50+ (Sept. 2020), I mention in "Visual Studio Code cannot detect installed Git" that you can add multiple paths.

That helps when your VSCode settings are synchronized across your machines, but your Git is installed in different places on said machines.

And don't forget, with VSCode 1.60+, "git.enabled": true.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • brilliant. it worked :) SO would not let me accept the answer yet, but I will in a few minutes. I wonder why this happened suddenly. I have the path in my environment variables. It seemed that it used the path from there up until now. – dpdragnev Dec 16 '17 at 21:22
  • Did not work for me. I set the git.path setting, however, every time I start VS Code I still get "Git not found. Install it or configure it using the 'git.path' setting.". I'm on version 1.37 of VS Code. – dcp Aug 14 '19 at 00:27