VS Code uses the Git installation on your machine. It does not bundle its own copy of Git. To set up Git in VS Code, you need Git installed and your name and email configured so Git knows who is making each commit.
Once Git is ready, learn how to /vscode/how-to-sign-in-to-github-from-vs-code and /vscode/how-to-initialize-a-git-repository-and-publish-it-to-github-from-vs-code.
Install Git
VS Code requires Git version 2.0.0 or later. If you already have Git installed, skip to the next section.
| Platform | Recommended method |
|---|---|
| Windows | Download the installer from git-scm.com. Run it and accept the defaults. Git Bash is included. |
| macOS | Run brew install git if you have Homebrew, or download the installer from git-scm.com. |
| Linux | Use your package manager: sudo apt install git (Ubuntu/Debian), sudo dnf install git (Fedora), or sudo pacman -S git (Arch). |
After installing, open a terminal and run this command to confirm the version:
git --versionYou should see something like git version 2.47.0 or later.
If you installed Git while VS Code was already open, restart VS Code. The editor checks for Git at startup and enables source control features only when it detects a working installation.
Configure your name and email
Git attaches a name and email address to every commit. You only need to set these once per machine. Open a terminal (any terminal works: the VS Code integrated terminal, your system terminal, or Git Bash on Windows) and run:
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"Replace "Your Name" with the name you want on your commits and "your.email@example.com" with your actual email address.
The --global flag writes these values to your global Git configuration file (~/.gitconfig on macOS and Linux, C:\Users\YourName.gitconfig on Windows). VS Code reads this file automatically.
Verify the configuration
To confirm Git is properly set up in VS Code:
Open VS Code
If you just installed Git, restart VS Code first.
Look at the Activity Bar
The Source Control icon (a branch symbol) appears on the left Activity Bar. If you see it, VS Code detected Git.
Open a folder
Open any folder with File > Open Folder. If the folder is not a Git repository yet, the Source Control view shows a button to initialize one.
Check your config
Open the integrated terminal with Ctrl+** (Windows/Linux) or **Cmd+ (macOS) and run:
git config --global --listYour configured user.name and user.email should appear in the output.
Use a different identity per repository
Your global name and email apply to every repository on your machine. If you need a different identity for a specific project (for example, a work email for a work repository), open that project in VS Code and run these commands in the integrated terminal without --global:
git config user.name "Work Name"
git config user.email "work@company.com"This writes the values to the repository's local .git/config file. The local config overrides the global config for that repository only. VS Code honors both layers automatically.
What if VS Code does not detect Git?
If the Source Control icon does not appear in the Activity Bar after installing Git and restarting VS Code, try these checks:
- Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P) and run Git: Show Git Output. This opens a log that often explains the problem.
- Make sure Git is on your system PATH. Run
git --versionin your system terminal. If it works there but not in VS Code, you may need to restart VS Code or configure thegit.pathsetting. - Check the git.path setting if VS Code cannot find Git automatically. Open Settings (Ctrl+, / Cmd+,), search for git.path, and enter the full path to the Git executable (for example, C:\Program Files\Git\bin\git.exe on Windows or /usr/bin/git on Linux).
On Windows, if you install Git after VS Code, you may need to sign out and sign back in, or restart your computer, for the PATH update to take effect everywhere.
Once Git is working, explore how to /vscode/how-to-stage-commit-push-and-pull-changes-in-vs-code to start tracking your code.
Rune AI
Key Insights
- Install Git from git-scm.com before using source control in VS Code.
- Configure your global name and email with
git config --global user.nameandgit config --global user.email. - VS Code detects Git automatically; the Source Control icon in the Activity Bar confirms it.
- Restart VS Code after installing Git so the editor picks up the new installation.
- Use per-repository config (
git configwithout--global) to override your identity for a specific project.
Frequently Asked Questions
How do I check if Git is already installed?
What happens if I do not configure a Git username and email?
Can I use a different name and email for a single repository?
Does VS Code come with its own Git installation?
Conclusion
Once Git is installed and your name and email are configured, VS Code detects Git automatically. The Source Control icon in the Activity Bar confirms Git is ready, and you can move on to cloning a repository or initializing your first project.
More in this topic
How to Use VS Code with WSL 2 on Windows
Run VS Code connected to Windows Subsystem for Linux so you can develop in a full Linux environment with native tools, terminals, and debugging, all from Windows.
20 Best VS Code Extensions for Web Developers in 2026
Twenty carefully chosen VS Code extensions every web developer should know. Covers formatting, linting, frameworks, debugging, Git, and developer experience.
How to Install, Disable, Update, and Uninstall VS Code Extensions
Learn how to install, disable, update, and uninstall VS Code extensions from the Marketplace and the command line. Step-by-step instructions for every action.