Change email address in Git

∥☆過路亽.° 提交于 2020-04-07 11:10:35

问题


I have a project hosted in Git stash. 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?


回答1:


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 "your_email@abc.com"
  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 "your_email@abc.com"
  1. Confirm that you have set your email address:
git config --global user.email

Or using environment variables

  1. GIT_COMMITTER_EMAIL=your_email@abc.com
  2. GIT_AUTHOR_EMAIL=your_email@abc.com

PD: Info from github official guide




回答2:


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 johndoe@example.com  

Then just check to make sure the change took effect

$ git config --list

This is listed in

1.6 Getting Started - First-Time Git Setup




回答3:


use

"git -c user.name="your name" -c user.email=youremail@email.com commit --amend --reset-author"




回答4:


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



来源:https://stackoverflow.com/questions/37805621/change-email-address-in-git

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!