问题
I executed the following commands:
git pull <partner_remote> <partner_branch>
git config user.email <my_email>
git config user.name <my_name>
git commit --amend --reset-author
git push <my_remote> HEAD:refs/for/<my_branch>
But I got the following error after the "git push":
remote: ERROR: In commit b6b74fff7850c4b61a5535519959b1ab58ca6fa9
remote: ERROR: committer email address aaa@aaa
remote: ERROR: does not match your user account.
remote: ERROR:
remote: ERROR: The following addresses are currently registered:
remote: ERROR: bbb@bbb
remote: ERROR:
remote: ERROR: To register an email address, please visit:
remote: ERROR: http://xxxxxxxx
I have no idea how to fix it.
回答1:
In addition, one may get the same error when you're trying to commit other people's changes. It's a pretty common use case in my team when there is a commit in review from John, but John went to vacation\sick leave\day off and some feedback appeared. So if commit has to me merged ASAP, it requires some changes. Gerrit allows you to checkout anyone's commit, make a change and upload it as a new patch set. The original author (John) will be still "Author", but you will be "Commiter".
It was just a brief description of the case, now back to the issue. In my team our Gerrit configuration is set up so "Submitter" by default doesn't have Forge Author\Forge Committer permissions, so you'll get the very same error as mentioned in the question when trying to upload a new patch set.
The solution is to request higher role in your gerrit project (Maintainer, Developer or Administrator)
As an alternative, one can force override author of the commit:
git commit --amend --reset-author
回答2:
If I understood correctly, (aaa@aaa) is different from bbb@bbb e-mail which is registered in Gerrit, right? So... check if aaa@aaa is your correct e-mail and register it in Gerrit:
- Go to Gerrit
- Click on "YOUR NAME" (up right)
- Click on "Settings"
- Click on "Contact Information"
- Click on "Register New Email..."
- Fill the field with aaa@aaa and click on "Register"
You'll receive a "[Gerrit Code Review] Email Verification" e-mail, follow the instructions to add the aaa@aaa email address to your user account.
回答3:
This is due to git credential-manager storing the previous login Credential.
Here is the Fix, Just Execute :
git credential-manager clear <gerrit url>
eg : git credential-manager clear https://mygerrit.com
If you Push or clone again it will prompt for Username and Password
回答4:
Go Gerrit -> Settings -> HTTP Credentials,follow guide step to finished below option: Obtain password (opens in a new tab)
来源:https://stackoverflow.com/questions/40650926/git-push-error-does-not-match-your-user-account