Git推送错误:与您的用户帐户不匹配

Lay*_*CCC 5 git gerrit

我执行了以下命令:

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>
Run Code Online (Sandbox Code Playgroud)

但是在“ 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
Run Code Online (Sandbox Code Playgroud)

我不知道如何解决它。

The*_*her 8

此外,当您尝试提交其他人的更改时,可能会遇到相同的错误。这是我团队中一个非常常见的用例,当 John 提交审查时,但 John 去休假\病假\休息日并且出现了一些反馈。因此,如果提交必须尽快合并给我,则需要进行一些更改。Gerrit 允许您检查任何人的提交,进行更改并将其作为新补丁集上传。原作者 (John) 仍将是“作者”,但您将是“提交者”。

以上只是对案例的简要描述,现在回到问题。在我的团队中,我们的 Gerrit 配置设置为默认情况下“提交者”没有Forge Author\Forge Committer权限,因此在尝试上传新补丁集时,您将遇到与问题中提到的完全相同的错误。

解决方案是在您的 gerrit 项目中请求更高的角色(维护者、开发者或管理员)

作为替代方案,可以强制覆盖提交的作者:

git commit --amend --reset-author
Run Code Online (Sandbox Code Playgroud)


小智 7

您可以运行以下命令:

git config --global user.name "Your Name"
git config --global user.email you@example.com
Run Code Online (Sandbox Code Playgroud)

然后运行它来编辑提交以重置作者:

git commit --amend --reset-author
Run Code Online (Sandbox Code Playgroud)


Mar*_*ira 3

如果我理解正确的话,(aaa@aaa) 与 Gerrit 中注册的 bbb@bbb 电子邮件不同,对吧?所以...检查 aaa@aaa 是否是您正确的电子邮件并在 Gerrit 中注册:

  1. 前往格里特
  2. 点击“您的名字”(右上角)
  3. 点击“设置”
  4. 点击“联系信息”
  5. 点击“注册新电子邮件...”
  6. 在字段中填写aaa@aaa,然后单击“注册”

您将收到一封“[Gerrit Code Review]电子邮件验证”电子邮件,按照说明将 aaa@aaa 电子邮件地址添加到您的用户帐户。

  • 问题是操作员可能无法访问 aaa@aaa 电子邮件地址。这是从哪里来的以及如何改变它? (3认同)