ERROR: missing Change-Id in commit message footer

最近從Eclipse換到IDEA作爲工作環境進行開發。我們公司用的是gerrit+git。進行代碼管理工作,idea上添加git 如果是默認路徑會自動添加上git,然後在gerrit上搜索gerrit插件,這裏有個gerrit和git

當更改代碼後提交可以正常上master 之後push to gerrit則報下面的錯誤:

Delta compression using up to 4 threads.
Total 10 (delta 5), reused 0 (delta 0)
remote: 
remote: Processing changes: refs: 1        
remote: Processing changes: refs: 1, done            
remote: ERROR: missing Change-Id in commit message footer        
remote: Suggestion for commit message:        
remote: 測試idea提交        
remote: 
To ssh://[email protected]:29418/vcheck/vcheck-portal
remote: Signed-off-by: r170004 <[email protected]>        
!    refs/heads/master:refs/for/master    [remote rejected] (missing Change-Id in commit message footer)
remote: 
remote: Change-Id: I6ae28295785999f7dc99a3840f1a3e1b8383fbee        
remote: 
remote: Hint: To automatically insert Change-Id, install the hook:        
remote:   scp -p -P 29418 [email protected]:hooks/commit-msg .git/hooks/        
remote: 
remote: 
error: failed to push some refs to 'ssh://[email protected]:29418/vcheck/vcheck-portal'

 

處理方式:

1、 在idea 的Teminal 執行 ,給當前idea的項目添加 執行scp命令是從gerrit代碼服務器上將鉤子腳本文件commit-msg下載到項目的鉤子目錄下

2、在Temianl下對提交進行修改,將change-id追加到提交的地方:

         git commit --amend 執行後會進入提交message,添加change-id

3、推送代碼到服務器上:

          git push origin HEAD:refs/for/master  (我這裏推送到master分支上)

 

這樣就可以了。主要是因爲chang-id在提交時沒有 而gerrit要求每個提交都要有chang-id 所以加上就可以了。

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章