Apps & Platforms

Fix “git is not recognized in VS Code” on Windows 11

Find out whether Git is missing, unavailable on PATH, or simply not detected by VS Code—and follow the right fix for each case.

Fix “git is not recognized in VS Code” on Windows 11

If git is not recognized in VS Code appears in the Windows 11 terminal, Windows cannot find the Git command in the environment available to that terminal. Git may not be installed, or it may be installed without being available on PATH. If Git works in PowerShell outside VS Code, the editor may simply need to refresh or be pointed to the Git executable.

Work through the checks below in order. Start by testing the command, install Git for Windows if needed, then restart VS Code before changing any settings.

1. Check whether Git is available

In VS Code, open the integrated terminal and run:

git --version

If Windows prints a version number, Git is available to that terminal. The original message may come from a different terminal session or from VS Code’s separate source control integration; continue to the detection checks below if the editor still cannot use Git.

If PowerShell responds that git is not recognized, the command is not available in that environment. That does not by itself tell you whether Git is absent or just missing from PATH. Check the same command in a separate PowerShell window. If it fails there too, install Git or repair its command-line availability. If it works outside VS Code, skip to step 3.

2. Install Git for Windows with command-line access

Download the Windows installer from the official Git for Windows installation page. VS Code’s built-in Git features use a Git installation on your computer; GitHub sign-in or a GitHub account alone does not provide the Git command.

During setup, pay attention to the installer’s PATH or command-line integration choice. Choose the option that makes Git available from the Windows command prompt and other software, including VS Code. An option that limits Git to its own shell will not solve a missing git command in PowerShell. Installer wording can vary, so look for the choice that allows command-line tools and applications to use Git. For the remaining screens, the standard installer settings are a reasonable starting point unless you have a specific setup requirement.

When installation finishes, close any open PowerShell windows. Then open a new PowerShell window and run:

git --version

A version response confirms that the new shell can find Git. If the command still is not recognized outside VS Code, revisit the installation and PATH choice before troubleshooting the editor.

If you installed GitHub Desktop, note that it does not replace the Git distribution VS Code needs for its built-in Git integration. Install Git for Windows as well, then check the command in PowerShell.

3. Restart VS Code to refresh its environment

After installing Git or changing its PATH availability, close and reopen VS Code. Opening a fresh integrated terminal inside an already-running editor may not be enough: VS Code itself may still be using the environment it had when it launched. Restarting the application gives it a chance to detect the updated Git installation.

Open a new integrated terminal and run git --version again. If it now prints a version, the terminal can find Git. If the terminal command works but VS Code’s Source Control view still reports that Git is unavailable, troubleshoot the editor’s detection separately in the next step.

4. Troubleshoot VS Code’s Git detection

VS Code’s terminal and its built-in source control feature are related, but they are not the same check. The terminal runs commands in its selected shell. Source Control must also locate the Git installation to provide its Git features.

  1. Confirm the environment. Run git --version in the VS Code terminal where the problem occurs. If it fails there but works in a separate PowerShell window, the issue is specific to the environment VS Code is using. Restart VS Code once more after installation or PATH changes.
  2. Read the Git Output window. In VS Code, open the Output panel and select Git from its output-channel list. Check the messages for details about why the editor could not find or start Git. This can help distinguish a detection problem from a terminal command problem.
  3. Use git.path only if needed. If Git works in the relevant environment but VS Code still cannot detect it, configure the git.path setting to point to the Git executable on your computer. Use the actual location of the executable from your installation rather than guessing a path. Reopen VS Code and check Source Control again.

Changing git.path is not the first fix for a missing terminal command. If git --version fails in PowerShell, resolve installation or PATH availability first. A VS Code setting cannot make Git available to every other terminal or command-line tool.

5. Set the name and email Git uses for commits

Once Git is available, set a commit author name and email if you have not configured them. VS Code’s Git integration requires these details to create commits. They identify the author on commits; they are different from the credentials you use to sign in to GitHub.

In a terminal, replace the example values with the name and email you want attached to your commits:

git config --global user.name "Your Name"
git config --global user.email "you@example.com"

The --global option sets the values for your Git user configuration rather than only for the current repository. These commands configure commit identity; they do not sign you in to GitHub.

6. Verify the fix in VS Code

In a newly opened VS Code terminal, run:

git --version

If it returns a version, the terminal can run Git. Check the Source Control view too if that was where you first saw the problem. If the terminal works but Source Control does not, return to the Git Output window and the git.path check. If Git runs but you cannot access a GitHub repository or push changes, investigate that as a separate authentication or repository-access issue—not as the original “command not recognized” error.

Bottom line: fix “git is not recognized in VS Code”

To fix git is not recognized in VS Code, first test git --version in the affected terminal. Install Git for Windows with command-line access if the command is missing, then restart VS Code so it can refresh its environment. If Git works in the terminal but Source Control cannot detect it, check the Git Output window and set git.path only when necessary. Finally, configure a commit name and email; GitHub sign-in is a separate step.

Sources

Keep this guide handy

Share it or save the link for later.