Git\Gerrit 远程拒绝,并显示“提交消息页脚中缺少 Change-Id”

Jac*_*mit 5 git gerrit

首先,让我承认我不是 git 大师,甚至不是 git 新手。我们安装了 gerrit,有时我可以对存储库进行更改。这是我遵循的步骤:

  1. git add file.txt

    git add file2.txt..... 等等

  2. git commit -m"My awesome commit message"
  3. git push origin master:refs/for/master

这十次中有九次有效,但十次中有一次我得到“提交消息页脚中缺少 Change-Id”,然后我执行 git commit --amend ,我可以看到提交消息在那里。

这就是我咆哮的地方,因为我不明白为什么我有时会遇到这个问题。当前提交 --amend 在顶部显示我的消息,一个空行,然后是包含 Change-Id: 的行。然后是另一个空行和下面带有注释的行(由.. git 添加?)

我该如何解决这个问题,以及如何永久修复它,这样我就再也不会遇到这个问题了?我承认这是我知识的缺乏——100%

这就是我得到的结果: git commit --amend: 在此输入图像描述

hsp*_*her 1

这似乎是Gerrit的要求

如果推送的提交的提交消息页脚(最后一段)中不包含 Change-Id,则 Gerrit 会拒绝将提交推送到配置为始终需要提交消息中的 Change-Id 的项目。

发生此错误的原因可能有多种:

1. missing Change-Id in the commit message

2. Change-Id is contained in the commit message but not in the last paragraph
Run Code Online (Sandbox Code Playgroud)

提交消息页脚问题中缺少 Change-Id