This blog describes:
How to Change Email Address in Git Globally?
If developers want to change the email address accessible for all users available on Git repositories, they need to configure the user email address globally. To change the email address in Git globally, follow the instructions step by step.
Step 1: Check Existing User Email
First, check the existing globally saved user email through the “git config” command along with the “–global” option and “user.name”:
It can be observed that the configured user mail is displayed as the output:
Step 2: Change Email Address
Now, execute the “git config” command with the “–global” option along with the new user email address:
Step 3: Verify Newly Added Email
Lastly, verify the newly added or configured email address:
According to the below-provided output, the existing email is changed with the newly added email address:
Let’s have a quick look at the next section to learn how to change the email address in Git locally.
How to Change Email Address in Git Locally?
Local email addresses can be accessible for specific repository users. Follow the steps to save or change the new user email address.
Step 1: Check Existing User Email
To check the already configured saved user email address, run the following command:
Step 2: Change Email Address
Now, execute the “git config” command with the new email address:
Step 3: Ensure Added Email
Lastly, execute the “git config” command to ensure the configured email address:
It can be seen that the local email address has been changed successfully:
That’s all! We have provided the method to change the email address in Git globally and locally.
Conclusion
The globally changed user email is accessible for all repositories in the Git root directory. In contrast, the locally saved user email can be permitted for specific repositories. To change the user email globally, the “$ git config –global user.email <email-address>” command and to change the user email locally, the “$ git config –global user.email <email-address>” command can be utilized. This post demonstrated the procedure to change the user email addresses globally and locally.