It may be quite confusing, but in git ‘commit author’ and ‘committer’ are
separate beasts.
Let’s imagine you have a remote Gerrit repo and you noticed your last commit
has author’s email configured as foo@internal.com:
1234567
commit af434be3126cfbcaf450b04137d4d09cd87f8a47
Author: Name Surname <foo@internal.com>
Date: Sat Dec 10 20:34:30 2016 -0800
Add more bewbs
Change-Id: Idca25cc30ac8ee311ac93a962e1c2f3d3e9a3416
Gerrit expects it to be foo@company.com. So an attempt to push
change request to the community repo results in error
123456
remote: ERROR: In commit af434be3126cfbcaf450b04137d4d09cd87f8a47
remote: ERROR: committer email address foo@internal.com
remote: ERROR: does not match your user account.
remote: ERROR:
remote: ERROR: The following addresses are currently registered:
remote: ERROR: foo@company.com
commit c82db34717123c9e3c31c3a330dd81059880afac
Author: Name Surname <foo@company.com>
Date: Sat Dec 10 20:34:30 2016 -0800
Add more bewbs
Change-Id: Idca25cc30ac8ee311ac93a962e1c2f3d3e9a3416
but does push works now? Nope!
123456
remote: ERROR: In commit c82db34717123c9e3c31c3a330dd81059880afac
remote: ERROR: committer email address foo@internal.com
remote: ERROR: does not match your user account.
remote: ERROR:
remote: ERROR: The following addresses are currently registered:
remote: ERROR: foo@company.com
what the heck? The answer is quite simple – we didn’t reset committer’s
email along with author’s one. Let’s check git log with ‘fuller’ option supplied.
1234567891011
git log --format=fuller
commit c82db34717123c9e3c31c3a330dd81059880afac
Author: Name Surname <foo@company.com>
AuthorDate: Sat Dec 10 20:34:30 2016 -0800
Commit: Name Surname <foo@internal.com>
CommitDate: Sat Dec 10 20:35:24 2016 -0800
Add more bewbs
Change-Id: Idca25cc30ac8ee311ac93a962e1c2f3d3e9a3416
this is the reason. You want to export GIT_COMMITTER_EMAIL variable
1
export GIT_COMMITTER_EMAIL=foo@company.com
and, potentially, GIT_COMMITTER_NAME prior to the rebase so committer
information is being set correctly.