VS Code Not Detecting Git: How to Fix the Git Path

Fix VS Code when it cannot find Git. Covers the git.path setting, Git installation checks, PATH configuration on Windows, macOS, and Linux, and Git output log diagnosis.

6 min read

When VS Code cannot detect Git, the Source Control view shows a message like "Git not found" or no source control provider appears at all. The fix is usually straightforward: Git is either not installed, not on your PATH, or VS Code is looking in the wrong place.

This guide walks through the fixes in order from quickest to most involved.

Check if Git is installed

First, verify Git is actually on your machine. Open a terminal outside VS Code and run:

bashbash
git --version

If this returns a version number, Git is installed and available to that shell.

If you see "command not found" or an equivalent error, Git is not installed or is not on that shell's PATH. Install Git from the official Git downloads page. VS Code's built-in Git support requires Git 2.0.0 or later.

After installing, restart your terminal and VS Code. The Source Control view should detect Git automatically on the next launch.

Check the Git output first

If the terminal finds Git but VS Code does not, run Git: Show Git Output from the Command Palette. You can also open Source Control, select the ... menu, and choose Show Git Output.

The official source control troubleshooting guide confirms that this log shows the Git executable location, commands, and errors. Check the first detection messages before changing settings.

If VS Code reports that Git is disabled, open Settings and confirm that Git: Enabled is selected.

Set the git.path setting

Use Git: Path only if automatic detection still selects no executable or the wrong one. Find the path resolved by your terminal:

  • Windows Command Prompt or PowerShell: where.exe git
  • macOS or Linux: command -v git

Copy the executable path returned on your machine. Open Settings, search for git path, and paste that full path into Git: Path.

After setting the path, run Developer: Reload Window from the Command Palette. Open the Source Control view. If Git is now detected, you will see options to open a folder, clone a repository, or initialize a repository.

Fix PATH issues on Windows

The most common Git detection problem on Windows is that Git was installed but not added to the system PATH.

During Git for Windows installation, you are asked about PATH configuration. The recommended choice is "Git from the command line and also from 3rd-party software." If a different option was selected, Git works in Git Bash but not from Command Prompt or VS Code.

Re-run the official Git installer and choose the option that makes Git available to command-line and third-party programs. This is safer than guessing an installation directory.

If you repair PATH manually, add the directory containing the git.exe found on your machine to your User Path. Do not replace existing Path entries.

After changing PATH, close all VS Code windows and reopen the application so it receives the new environment.

Fix macOS issues

On macOS, Git is included with Xcode Command Line Tools. If you see an alert about installing command line tools when running git --version, follow the prompt to install them.

If you installed Git through a package manager and the terminal finds it, use the exact path returned by command -v git in Git: Path. This avoids assuming where the package manager installed it.

If you launch VS Code from the Dock or Finder rather than from the terminal, VS Code may not inherit the same PATH. Use the git.path setting described above to point directly to the Homebrew Git installation.

Once the Source Control view recognizes the repository, detection is fixed. If committing later reports a missing identity, follow the Git name and email setup guide. To use the detected repository, see how to stage, commit, push, and pull changes.

Rune AI

Rune AI

Key Insights

  • Verify Git works in a terminal with git --version.
  • Use Git: Show Git Output to see the executable and detection error.
  • Set Git: Path only when automatic detection does not find the correct executable.
  • Prefer a user-level PATH change over a system-wide change when a PATH repair is necessary.
  • Reopen VS Code after installing Git or changing the operating system PATH.
RunePowered by Rune AI

Frequently Asked Questions

Why does VS Code show Git missing even though Git is installed?

VS Code uses your machine's Git installation. If its environment cannot resolve Git, or Git: Path points to an invalid executable, the built-in Git extension cannot start. Open Git: Show Git Output to see which executable VS Code tried to use.

How do I find the Git executable VS Code is using?

Run Git: Show Git Output from the Command Palette. The Git Output window lists the location of the executable that VS Code is using. In a terminal, where.exe git on Windows or command -v git on macOS and Linux shows the path resolved by that shell.

Do I need to restart VS Code after fixing the Git path?

Reload VS Code with Developer: Reload Window after changing Git: Path. If you changed the operating system PATH or installed Git, close all VS Code windows and reopen the application so it receives the new environment.

Conclusion

Verify Git outside VS Code, inspect Git: Show Git Output, and set Git: Path only when automatic detection still fails. The fix is confirmed when the Source Control view recognizes an opened repository and Git Output lists a valid executable without a detection error.