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 email@example.com
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 firstname.lastname@example.org 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 email@example.com
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