Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Code cannot detect installed git

People also ask

How do I get the VS Code to recognize Git?

Step 1: Go to the Settings in vscode. Step 2: Open settings. json. Step 4: just add the directory path where git is installed in your system.

How do I fix Git not recognized?

Fix 1: Restart Command Prompt Step 2: Press Win + S to open the Windows Search utility. Step 3: Search for Command Prompt and right-click it. Then select Run as administrator. Then you can try running a git command again and check if the error disappears.

How do I know if Git is installed or not?

Open the command prompt "terminal" and type git version to verify Git was installed.


Now you can configure Visual Studio Code (version 0.10.2, check for older versions) to use existing git installation.

Just add the path to the git executable in your Visual Studio Code settings (File -> Preferences -> Settings) like this:

{
    // Is git enabled
    "git.enabled": true,

    // Path to the git executable
    "git.path": "C:\\path\\to\\git.exe"

    // other settings
}

Visual Studio Code simply looks in your PATH for git. Many UI clients ship with a "Portable Git" for simplicity, and do not add git to the path.

If you add your existing git client to your PATH (so that it can find git.exe), Visual Studio Code should enable Git source control management.


Update 2020 (Mac)

Went through this $h!† again after updating to Catalina, which requires an XCode update.

And to clarify, while this post is about VS Code, this issue, is system wide. Your git install is affected/hosed. You can try to run git in your terminal/bash/zsh or whatever it is now and it just won't.

Same fix, just update XCode, start it up and agree to license. That's it.


Old post, but just hit this on MAC/OSXso hope this helps someone.

Symptoms:

  • You've been using VS Code for some time and have no issues with Git
  • You install XCode (for whatever reason - OS update, etc)
  • After installing XCode, VS Code suddenly "can't find Git and asks you to either install or set the Path in settings"

Quick fix:

Run XCode (for the first time, after installing) and agree to license. That's it.

How I stumbled upon this "fix":

After going through numerous tips about checking git, e.g. which git and git --version, the latter actually offered clues with this Terminal message:

Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command.

As to why XCode would even wrap it's hands on git, WAT

Happy holidays and happy coding :)


This can happen after upgrading macOS. Try running git from a terminal and see if the error message begins with:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) ...

If so the fix is to run

xcode-select --install

from the terminal. see this answer for more details


In Visual Studio Code open 'user settings': ctrl + p and type >sett press enter

This will open default settings on left side and User settings on right side.

Just add path to git.exe in user settings

"git.path": "C:\\Users\\[WINDOWS_USER]\\AppData\\Local\\Programs\\Git\\bin\\git.exe"

Replace [WINDOWS_USER] with your user name.

Restart Visual Studio Code


I had this problem after upgrading to macOS Catalina.

The issue is resolved as follows:

1. Find git location from the terminal:

which git

2. Add the location of git in settings file with your location:

settings.json

"git.path": "/usr/local/bin/git",

Depending on your platform, the user settings file (settings.json) is located here:

Windows %APPDATA%\Code\User\settings.json

macOS $HOME/Library/Application Support/Code/User/settings.json

Linux $HOME/.config/Code/User/settings.json