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.
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