Global Git username and email
The global git username and email address are associated with commits on all repositories on your system that don’t have repository-specific values.
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@yourdomain.com"
Once done, you can confirm that the information is set by running:
$ git config --list
Make sure the output contains the user.name and user.email are correct as you set above
The command saves the values in the global configuration file, ~/.gitconfig:
Git username and email for a single repository
If you want to use a different username or email address for a specific repository, run the git config command without the --global option from within the repository directory.
Let's say you want to set for your project abc, then just open terminal from abc then run these command.
$ git config user.name "Your Name"
$ git config user.email "youremail@yourdomain.com"
Once done, you can confirm that the information is set by running:
$ git config --list
Make sure the output contains the user.name and user.email are correct as you set above
The repository-specific setting are kept in the .git/config file under the root directory of the repository.