To set your user name for Git, enter the following command in your terminal:
git config --global user.name "Your Name"
To set your email for Git, enter the following command in your terminal:
git config --global user.email firstname.lastname@example.org
If you need to change your user name or email, you can use the same commands from above. Replace “Your Name” with your actual name and email@example.com with your actual email address.
To check your list of settings, including your user name and email, enter the following command in your terminal:
git config --list
You should see something similar to the following print out in your terminal:
credential.helper=osxkeychain filter.lfs.required=true filter.lfs.clean=git-lfs clean -- %f filter.lfs.smudge=git-lfs smudge -- %f filter.lfs.process=git-lfs filter-process user.name=John Smith firstname.lastname@example.org
Use the commands from the summary to set your username and email address for Git. Use
git config --list to check that they were set correctly.
First-Time Git Setup from the Pro Git book