Change email address in Git

GitEmailJenkins

Git Problem Overview


I have a project hosted in Git stash (now rebranded as Bitbucket Server). It is built using jenkins. Now I made a typo while installing my Git locally. Like @ab.com instead of @abc.com

After every build, jenkins sends email notifications and it picks up my incorrect email address from Git commit and tries to send it.

Even after I have changed the email address in my local Git, I still see jenkins sending the emails to the old incorrect address.

How can I fix this?

Git Solutions


Solution 1 - Git

Locally set email-address (separately for each repository)
  1. Open Git Bash.

  2. Change the current working directory to the local repository in which you want to set your Git config email.

  3. Set your email address with the following command:

git config user.email "[email protected]"
  1. Confirm that you have set your email address correctly with the following command.
git config user.email
Globally set email-address (only used when nothing is set locally)
  1. Open Git Bash.

  2. Set your email address with the following command:

git config --global user.email "[email protected]"
  1. Confirm that you have set your email address:
git config --global user.email
Or using environment variables
  1. [email protected]
  2. [email protected]

PD: Info from github official guide

Solution 2 - Git

According to the git documentation, all you should have to do is re-run

$ git config --global user.name "John Doe"  
$ git config --global user.email [email protected]  

Then just check to make sure the change took effect

$ git config --list

This is listed in the Pro Git book, written by Scott Chacon and Ben Straub >1.6 Getting Started - First-Time Git Setup

Solution 3 - Git

use

> "git -c user.name="your name" -c user.email=[email protected] > commit --amend --reset-author"

Solution 4 - Git

To set your global username/email configuration:

  1. Open the command line.

  2. Set your username:

    git config --global user.name "FIRST_NAME LAST_NAME"

  3. Set your email address:

    git config --global user.email "[email protected]"

To set repository-specific username/email configuration:

  1. From the command line, change into the repository directory.

  2. Set your username:

    git config user.name "FIRST_NAME LAST_NAME"

  3. Set your email address:

    git config user.email "[email protected]"

  4. Verify your configuration by displaying your configuration file:

    cat .git/config

For more information and for other version control systems .. => SeeThis

Solution 5 - Git

Edit your email directly in the JENKINS_HOME/users/YOUR_NAME/config.xml configuration file and restart the Jenkins server

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionmani_nzView Question on Stackoverflow
Solution 1 - GitMarcView Answer on Stackoverflow
Solution 2 - GitDonald L WilsonView Answer on Stackoverflow
Solution 3 - Gituser3143487View Answer on Stackoverflow
Solution 4 - GitEndriyasView Answer on Stackoverflow
Solution 5 - GitJan PytlíkView Answer on Stackoverflow