0

With a command similar to

git checkout -b a7e4767 new-branch
git push origin new-branch

I get the following error

remote: ERROR:  In commit a7e4767a80e9b0730c8708973918c990af308a45        
remote: ERROR:  committer email address someone.else@xyz.com        
remote: ERROR:  does not match your user account.        
remote: ERROR:        
remote: ERROR:  The following addresses are currently registered:        
remote: ERROR:    my.self@sap.com

All my search turns up suggestions for amending the commit, but I don't think I want to amend that old commit.

Miserable Variable
  • 28,432
  • 15
  • 72
  • 133
  • 1
    This doesn't sound like a `git` issue, strictly speaking. This sounds more like a webhook. What service are you using... GitHub, BitBucket, GitLab? Any custom hooks? – JDB Mar 29 '17 at 01:34
  • @JDB It's my corporate git server, and I am sure there are custom hooks but I don't know what they are. Can you explain why you don't think it is git issue, that will help me ask a more intelligent question to corporate support (they are not always as tolerant as SO :) ) – Miserable Variable Mar 29 '17 at 01:40
  • 1
    Anything prefixed with `remote:` is coming from the other Git involved in the push, but if it comes *directly* from that Git, it does not get the `remote:` prefix. So it therefore must be from a hook. It's pretty standard, in corporate environments, to check for misconfiguration or spoofing, depending on how much trust their is from management down to lower level employees... :-) – torek Mar 29 '17 at 06:55

2 Answers2

0

This doesn't sound like a git issue, strictly speaking. This sounds more like a feature offered by Gerrit

If you are registered with the system and your email address is setup correctly in your local repo, then you might be able to layer over a new commit with no changes and push that. The new commit will be tagged with your email address, which gets around the need to modify the existing commit. See How to commit no change and new message?

I think the proper way to handle this situation, however, would be to get the "Forge Committer" permission.

Community
  • 1
  • 1
JDB
  • 25,172
  • 5
  • 72
  • 123
  • I don't want to create a new commit either. I just want to create a remote branch that points to a commit by someone else – Miserable Variable Mar 29 '17 at 02:49
  • In that case, it sounds like you are going to need the "Forge Committer" permission. – JDB Mar 29 '17 at 02:50
  • I doubt. This worked: (1) `git checkout some-existing-remote-branch` (2) `git checkout -b new-branch` (3) `git push origin new-brach`. But it did not work when (1) was replaced by (1) `git checkout some-existing-label` – Miserable Variable Mar 29 '17 at 04:23
0

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="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"

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 = your-correct-email@example.com

Then

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

PS: This is on a Gerrit Server

milegrin
  • 121
  • 3