Reputation: 5652
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.example
instead of @abc.example
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?
Upvotes: 456
Views: 574958
Reputation: 455
I found what I was looking for in this guide (specifically, Method 1): https://blog.hao.dev/how-to-use-different-git-emails-for-personal-and-work-repositories-on-the-same-machine
Basically, you can have a global config file that conditionally includes specific config files per path, in my case:
[include]
my personal config to be the default, and then a [includeIf]
to override the config for specific paths)Upvotes: 5
Reputation: 355
This will overwrite the user's name and email in the last commit.
"git -c user.name="your name" -c [email protected]
commit --amend --reset-author"
Upvotes: 22
Reputation: 7944
Open Git Bash.
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 "[email protected]"
git config user.email
Open Git Bash.
Set your email address with the following command:
git config --global user.email "[email protected]"
git config --global user.email
PD: Info from GitHub official guide
Upvotes: 759
Reputation: 7978
The commands explained set the email in the .git/config locally:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = https://username:[email protected]/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 = [email protected]
Upvotes: 5
Reputation: 606
To set your global username/email configuration:
Open the command line.
Set your username:
git config --global user.name "FIRST_NAME LAST_NAME"
Set your email address:
git config --global user.email "[email protected]"
To set repository-specific username/email configuration:
From the command line, change into the repository directory.
Set your username:
git config user.name "FIRST_NAME LAST_NAME"
Set your email address:
git config user.email "[email protected]"
Verify your configuration by displaying your configuration file:
cat .gitconfig
For more information and for other version control systems .. => SeeThis
Upvotes: 13
Reputation: 1531
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
Upvotes: 138
Reputation: 1
Edit your email directly in the JENKINS_HOME/users/YOUR_NAME/config.xml
configuration file and restart the Jenkins server
Upvotes: 0