Git missing Change-Id in commit message footer解決方法
在Git向服務器提交代碼時,出現如下錯誤
missing Change-Id in commit message footer
1
原因:項目倉庫.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 xxxxx@xxxx:hooks/commit-msg ${gitdir}/hooks/ remote: And then amend the commit: remote: git commit --amend
如上所示,依次在項目路徑下輸入如下命令,即可解決:
gitdir=$(git rev-parse --git-dir); # 將xxxxx@xxxx 替換成相應用戶名、服務器即可(該命令從服務器拷貝commit-msg文件) scp -p -P 29418 xxxxx@xxxx:hooks/commit-msg ${gitdir}/hooks/ # 再提交一次即可生成change-id git commit --amend
解決辦法2:其實和上面的辦法差不多,如果將當前項目留有備份,直接將備份項目的.git/hooks/commit-msg拷貝到,當前項目相應目錄即可。
原文:https://blog.csdn.net/zxc024000/article/details/83824550