首页 文章

Gerrit报告找不到早期提交的更改ID

提问于
浏览
1

我正在尝试为我现有的GIT项目设置gerrit代码审查 .

gerrit实例在我的本地端口 9090 上运行 .

以下是我遵循的流程

  • 在Gerrit中创建空项目(没有初始提交) . 该项目的名称是 SpringBootBasic .

  • 在其他位置克隆了远程git仓库

git clone https://github.com/hemantvsn/boot.git
  • 由于gerrit需要每次提交的Change-Id,因此将提交消息挂钩复制到我的克隆存储库中
hemant:-~/Projects/boot$ scp -p -P 29418        
hemantvsn@127.0.0.1:hooks/commit-msg .git/hooks/commit-msg                                                                                  
            100% 4693     3.4MB/s   00:00    
hemant:-~/Projects/hem$
  • 添加了一个新的远程指向gerrit项目
hemant:-~/Projects/boot$ git remote add gerrit 
http://127.0.0.1:9090/SpringBootBasic
  • 做了一个小改动并承诺了 . 此提交中填充了更改ID .
hemant:-~/Projects/boot$ git log
--------------------------------
commit 98f1c6534492984364bdbc714407dbb8b39c06da
Author: hemant <hemantvsn@gmail.com>
Date:   Wed Apr 12 14:43:42 2017 +0530

Minor text changes.

Change-Id: I48e625c728add8be45b4dee0809c1d0d9804b7c8

--------------------------------

commit 5d485988e6d67394622bbd5d2d3146fc379b7ec3
Author: hemant <hemantvsn@gmail.com>
Date:   Wed Apr 5 13:22:09 2017 +0530

Added sysouts
--------------------------------

commit 330c5c6ca2fed898146efe81f99b4ee91faa614f
Author: hemant <hemantvsn@gmail.com>
Date:   Wed Apr 5 13:03:40 2017 +0530

changed index file
--------------------------------
  • 最后,当我将我的更改推送到gerrit报告时,它仍然显示错误,因为更改-Id未在提交中填充 .
hemant:-~/Projects/boot$ git push gerrit HEAD:refs/for/master
 Counting objects: 43, done.
 Delta compression using up to 4 threads.
 Compressing objects: 100% (29/29), done.
 Writing objects: 100% (43/43), 4.29 KiB | 0 bytes/s, done.
 Total 43 (delta 6), reused 0 (delta 0)
 remote: Resolving deltas: 100% (6/6)
 remote: Processing changes: refs: 1, done    
 remote: ERROR: [f905e04] missing Change-Id in commit message 
 footer
 remote: 
 remote: Hint: To automatically insert Change-Id, install the hook:
 remote:   gitdir=$(git rev-parse --git-dir); scp -p -P 29418 
 hemantvsn@127.0.0.1:hooks/commit-msg ${gitdir}/hooks/
 remote: And then amend the commit:
 remote:   git commit --amend
 remote: 
 To http://127.0.0.1:9090/SpringBootBasic
 ! [remote rejected] HEAD -> refs/for/master ([f905e04] missing 
 Change-Id in commit message footer)
 error: failed to push some refs to 
 'http://127.0.0.1:9090/SpringBootBasic'


 hemant:-~/Projects/boot$

似乎它指的是我在repo中的初始提交,这是在gerrit之前完成的 .

hemant:-~/Projects/boot$ git log --pretty=format:'%h %ad %s (%an)' --date=short 
98f1c65 2017-04-12 Minor text changes. (hemantvsn)
5d48598 2017-04-05 Added sysouts (hemant)
330c5c6 2017-04-05 changed index file (hemant)
90bb7be 2017-04-05 sonar file (hemant)
eca2fc2 2017-03-30 test (hemant)
f905e04 2017-02-03 Basic Spring Boot Project. (hemantvsn) **** This commit is referred in error report.

请建议需要做什么另外请建议配置中的任何更改 .

1 回答

  • 1

    您需要在存储库的所有提交中拥有Change-Id,您只需在最后一个提交中添加它 .

    将新存储库推送到Gerrit的正确方法是直接推送到分支(git push gerrit HEAD:refs / heads / master),但您需要获得许可才能执行此操作 . 请教您的Gerrit管理员 .

相关问题