在Git中更改电子邮件地址 [英] Change email address in Git
问题描述
我有一个在Git存储库中托管的项目。它是使用詹金斯构建的。
现在,我在本地安装Git时打了一个错字。
像@ ab.com而不是@ abc.com
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
在每次构建后,jenkins发送电子邮件通知,并从Git commit和
After every build, jenkins sends email notifications and it picks up my incorrect email address from Git commit and tries to send it.
即使我已经更改了本地Git中的电子邮件地址,我仍然看到詹金斯将电子邮件发送到旧的不正确地址。
Even after I have changed the email address in my local Git, I still see jenkins sending the emails to the old incorrect address.
我该如何解决?
推荐答案
本地设置电子邮件地址(对于每个存储库)
Locally set email-address (separately for each repository)
-
打开Git Bash。
Open Git Bash.
将当前工作目录更改为要在其中设置Git配置电子邮件的本地存储库。
Change the current working directory to the local repository in which you want to set your Git config email.
使用以下命令设置电子邮件地址:
Set your email address with the following command:
git config user.email "your_email@abc.com"
- 确认已使用以下命令正确设置了电子邮件地址。
git config user.email
全局设置的电子邮件地址(仅当本地未设置时使用)
Globally set email-address (only used when nothing is set locally)
-
打开Git Bash。
Open Git Bash.
使用以下命令:
git config --global user.email "your_email@abc.com"
- 确认已设置您的电子邮件地址:
git config --global user.email
或使用环境变量
Or using environment variables
-
GIT_COMMITTER_EMAIL=your_email@abc.com
-
GIT_AUTHOR_EMAIL=your_email@abc.com
GIT_COMMITTER_EMAIL=your_email@abc.com
GIT_AUTHOR_EMAIL=your_email@abc.com
PD:github官方指南中的信息
PD: Info from github official guide
这篇关于在Git中更改电子邮件地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!