Configuring Git Integration in VS Code Using PowerShell
If Visual Studio Code is not installed on your system, instructions on installation can be found at code.visualstudio.com. Note: You can run these commands in PowerShell if you prefer to use Git through PowerShell instead of VS Code.
Open VS Code and Integrated Terminal
Use the shortcut Ctrl+ to open the integrated terminal.
Ensure Git is Installed on Your System
To check if Git is installed, open a terminal and run:
git --versionIf it is not installed, instructions on installation can be found at git-scm.com.
Setup Environmental Variables
By default, Git is usually installed in one of these locations:
- C:\Program Files\Git\bin\git.exe
- C:\Program Files (x86)\Git\bin\git.exe
Add Git To the System Path
For Windows 10 and Windows 11:
Search for Environment Variables:
- Right-click the Start button and select
System. - Click on
About, then selectSystem infoat the bottom right. - On the left sidebar, click on
Advanced system settings. - A System Properties window will pop up. Here, click on the
Environment Variablesbutton near the bottom.
- Right-click the Start button and select
Edit System PATH:
- In the Environment Variables window, under the
System variablessection, find and select thePathvariable, then clickEdit.... - If the path to Git is not there, add it:
- Click
Newand enter the path to your Git bin directory. This is usually installed in one of these locations:- C:\Program Files\Git\bin
- C:\Program Files (x86)\Git\bin
- Click
- In the Environment Variables window, under the
Restart Your System (Optional but Recommended)
Verify the Changes
git --versionConfigure Git
To configure Git, run the following commands:
Note: Enter your name and email in the corresponding " " sections
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"Review Your Git Config
git config --listor you can get fancy and look for only the set name and email variables.
git config --get user.name && git config --get user.email