Set Git credentials
This guide describes how to set your global Git user credentials using the Visual Studio Code (VSC) editor.
These steps are required to enable persistent interactions between Git, GitHub, Azure DevOps and VSC. Setting your global Git user credentials will distinguish your contributions to the course content from the contributions of others.
Prerequisites
Before you proceed complete the following:
Topics in this guide
Set your Git global credentials
Complete the following steps to set your global Git user credentials using VSC.
-
Open VSC, and go to View > Terminal (from the top menu). In the VSC TERMINAL pane, select 1:powershell from the dropdown menu.
Note: You may need to press Enter to display the contents of the VSC Terminal window. Your Git username will be shown in the VSC Terminal instead of the username shown in following images.
-
Type the following command into the VSC Terminal, then press Enter.
git config --list
Note how there are no references to
user.name
oremail.address
present in the VSC Terminal. This will change when you add your Git user credentials using the following steps. -
To configure your global Git user email address, type the following command into the VSC Terminal then press Enter. Replace the text “you @example.com” with the email address you use with your GitHub user account.
git config --global user.email "you@example.com"
-
To configure your global Git username, type the following command into the VSC Terminal then press Enter. Replace the text “Your Github account user name” with the Git username you want to be identified by.
git config --global user.name "Your GitHub account user name"
-
Type the following command into the VSC Terminal, and press Enter.
git config --list
Note how the values for
user.name
andemail.address
are now present in the VSC Terminal.
You have set your global Git user credentials successfully. Close the VSC Terminal pane and the VSC editor.
Note: VSC does not verify the global Git user credentials you provide. Errors that mention permissions when you use Git may be caused by incorrect or misconfigured Git user credentials. Ensure you have the correct global Git user credentials and GitHub user account details in your Git configuration file (Git config). In Windows, the Git config file is stored at
C:\Program Files\Git\etc\gitconfig
.More information about configuring Git is available from the SCM webpage 8.1 Customizing Git - Git Configuration.
Appendices
Check the following supplementary Appendices for more details and context.