Git
is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. In this article, we will set up credentials for the git repository. These credentials can be set locally as well as globally.
When username and email are set globally, we don’t need to configure the credentials for each repository. The first thing we do is to configure username
and email
.
Change global username and email
By setting global username and email address, we link all our git credentials on all repositories in spite of specific projects. We run the git command with --global
option.
git config --global user.name "My Username"
git config --global user.email "myemail@mydomain.com"
Do you want to check where these credentials are stored? If so, they are stored in ~/.gitconfig
file. You can also modify this file as per your need. In Windows, you can find this file in the directory C:\Users\YourUsername
.
After you finished setting up the username and email, let’s check the newly added credentials in our terminal. To do so, we need to run the command:
git config --list
This command will list the available configuration. Username and Email are stored in the variables user.name
and user.email
variable. If you want to see each key’s value by typing command:
git config user.name
Note: The username and email address configuration of specific repository, will overwrite the global configuration.