1. 程式人生 > >Git missing Change-Id in commit message footer解決方法

Git missing Change-Id in commit message footer解決方法

Git missing Change-Id in commit message footer解決方法

  • 在Git向伺服器提交程式碼時,出現如下錯誤
missing Change-Id in commit message footer
  • 原因:專案倉庫.git/hooks目錄下,commit-msg檔案缺失。
  • 解決方法1:一般在提交程式碼報錯時,會給出相應解決的提示。
remote: Processing changes: refs: 1, done    
remote: ERROR: 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 [email protected]:hooks/commit-msg ${gitdir}/hooks/ remote: And then amend the commit: remote: git commit --amend
  • 如上所示,依次在專案路徑下輸入如下命令,即可解決:
gitdir=$(git rev-parse --git-dir); 
# 將[email protected] 替換成相應使用者名稱、伺服器即可(該命令從伺服器拷貝commit-msg檔案)
scp -p -P 29418 [email protected]:hooks/commit-msg ${gitdir}/hooks/ # 再提交一次即可生成change-id git commit --amend
  • 解決辦法2:其實和上面的辦法差不多,如果將當前專案留有備份,直接將備份專案的.git/hooks/commit-msg拷貝到,當前專案相應目錄即可。