Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Commiter email address does not match in IntelliJ even changing it to correct one

When I try to push my commits from git repository to gerrit remote repository from Linux environment in IntelliJ idea I get the following error:

remote: ERROR:  committer email address ***** [K
remote: ERROR:  does not match your user account.[K

Even if I changed the settings to the correct ones for git and gerrit (I can see that at: git config -l from console), it still picks the old "wrong" email.

What could be wrong?

like image 358
Tadas Davidsonas Avatar asked Jul 27 '15 11:07

Tadas Davidsonas


People also ask

How do I change my IntelliJ committer name?

Open the Terminal and execute one of the following commands: To set a name for every Git repository on your machine, use $ git config --global user.name "John Smith" To set a name for a single repository, use $ git config user.name "John Smith"

How do I change my Git repository URL in IntelliJ?

From the main menu, choose Git | Manage Remotes. The Git Remotes dialog will open. button on the toolbar or press Alt+Insert . In the dialog that opens, specify the remote name and URL and click OK.


3 Answers

you need to reconfigure your email

$ git config user.email <your email>
$ git commit --amend --reset-author

git commit --amend updates your last commits

like image 83
Frederic Henri Avatar answered Oct 22 '22 12:10

Frederic Henri


You can set the username and email for GIT integration as follows. This will help you to overcome the mismatch issue.

Go to your project where git is initialized.

Then enable the hidden folders and find ".git" and go inside the folder.

Find the file called "config" and add below code and save.

[user]
      name = username
      email = [email protected]

Enter your correct username and email accordingly. This will be picked permanently unless you go and change it.

like image 30
Dulith De Costa Avatar answered Oct 22 '22 10:10

Dulith De Costa


I experienced the same error when our corporate email address changed and for me was easily fixed with :

#!/bin/sh

git filter-branch --env-filter '

OLD_EMAIL="[email protected]"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="[email protected]"

if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_AUTHOR_NAME="$CORRECT_NAME"
export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
fi
' --tag-name-filter cat -- --branches --tags

Run in the root of the git repo.

Based on : https://help.github.com/en/github/using-git/changing-author-info

I also edited the repo's .git/config to add the user stanza :

[user]
  name = Your Correct Name
  email = [email protected]

Then

git commit --amend --reset-author
git push

PS: This is on a Gerrit Server

like image 1
milegrin Avatar answered Oct 22 '22 11:10

milegrin