Configuring Git Username and Email Address
We all work on multiple projects and it is frustrating to commit using the wrong Username and Email.
If it becomes a compliance issue, it can lead to unpleasant consequences.
Thus, I highly recommend setting global and local git configs.
Local git config should be set immediately after cloning a new repo.
Set Global Git Username and Email
To set your global commit name and email address, run the git config command with the --global option:
git config --global user.name "Your Name"
git config --global user.email "youremail@emailprovider.com"Verify the settings
git config --listThe output would be:
user.name=Your Name
user.email=youremail@emailprovider.comSet Git Username and Email local to Repository
Assume that you have created a new git repo or cloned one from Github, you can now set the local user for the repository.
Open the terminal and change the directory to your local repository.
cd .\workspace\new-repoSet a Git username and email for the local repo:
git config user.name "Your Name"
git config user.email "youremail@emailprovider.com"Verify the settings
git config --listThe output would be:
user.name=Your Name
user.email=youremail@emailprovider.comThe repository-specific settings are stored in the .git/config, located in the root directory of the repository.


