Configure username and email for Git commits

If you want to change your username or email address in Git you can do it for an individual repository or as default property. One time I had to do as I changed my mail address. Another time I had to do it for a project where I got a mail address from the customer. If you want to do it, open the terminal and set the default name and email by using the following command:

git config --global user.name "John Doe"
git config --global user.email john@doe.tld

To change the properties for a specific repository, you need to go to the working directory of your repository. Then you can change the name and email by using the following command:

git config user.name "Jim Doe"
git config user.email "jim@doe.tld"

You can find the name and email properties for the default configuration in the ~/.gitconfig file. The repository properties are stored in the .git/config file. It doesn’t matter which OS do you use. The commands are working for Windows, Mac and Linux.

chevron_left
chevron_right

Leave a comment

Your email address will not be published. Required fields are marked *

Comment
Name
Email
Website

This site uses Akismet to reduce spam. Learn how your comment data is processed.