我有一个项目托管在Git stash中(现已更名为Bitbucket Server),使用Jenkins构建。
现在,在本地安装Git时打了错字,例如:@ab.example
而不是@abc.example
每次构建后,Jenkins会发送电子邮件通知,并从Git提交中选择我的错误电子邮件地址进行发送。
即使我已经在本地Git中更改了电子邮件地址,仍然看到Jenkins将电子邮件发送到旧的错误地址。
我该如何解决这个问题?
我有一个项目托管在Git stash中(现已更名为Bitbucket Server),使用Jenkins构建。
现在,在本地安装Git时打了错字,例如:@ab.example
而不是@abc.example
每次构建后,Jenkins会发送电子邮件通知,并从Git提交中选择我的错误电子邮件地址进行发送。
即使我已经在本地Git中更改了电子邮件地址,仍然看到Jenkins将电子邮件发送到旧的错误地址。
我该如何解决这个问题?
打开 Git Bash。
将当前工作目录更改为您想要设置 Git 配置电子邮件的本地存储库。
使用以下命令设置您的电子邮件地址:
git config user.email "your_email@abc.example"
git config user.email
打开 Git Bash。
使用以下命令设置您的电子邮件地址:
git config --global user.email "your_email@abc.example"
git config --global user.email
GIT_COMMITTER_EMAIL=your_email@abc.example
GIT_AUTHOR_EMAIL=your_email@abc.example
注:来自GitHub官方指南的信息
git config --get user.email
命令来检查该值。 - AmanicA$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
然后只需检查以确保更改生效
$ git config --list
这在Scott Chacon和Ben Straub所著的《Pro Git》一书中有提及。
1.6 入门 - 初次运行 Git 前的配置
"git -c user.name="your name" -c user.email=youremail@email.com
commit --amend --reset-author"
设置全局用户名/电子邮件配置:
打开命令行。
设置您的用户名:
git config --global user.name "FIRST_NAME LAST_NAME"
设置您的电子邮件地址:
git config --global user.email "MY_NAME@example.com"
设置特定存储库的用户名/电子邮件配置:
从命令行中进入存储库目录。
设置您的用户名:
git config user.name "FIRST_NAME LAST_NAME"
设置您的电子邮件地址:
git config user.email "MY_NAME@example.com"
通过显示配置文件来验证您的配置:
cat .gitconfig
有关更多信息和其他版本控制系统,请参见此处:
下面解释的命令会在本地的 .git/config 文件中设置电子邮件:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = https://username:password@git.mydomain.io/username/repo.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[branch "beta"]
remote = origin
merge = refs/heads/beta
[user]
email = pippo.caio@sempronio.io
在 JENKINS_HOME/users/YOUR_NAME/config.xml
配置文件中直接编辑您的电子邮件,并重新启动 Jenkins 服务器。