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

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

在Git向服务器提交代码时,出现如下错误

missing Change-Idincommit message footer

原因:项目仓库.git/hooks目录下,commit-msg文件缺失。

解决方法:一般在提交代码报错时,会给出相应解决的提示。

remote: Processing changes: refs: 1,doneremote: ERROR: missing Change-Idincommit message footerremote: remote: Hint: To automatically insert Change-Id,installthe hook:remote:  gitdir=$(gitrev-parse --git-dir);scp-p -P 29418 xxxxx@xxxx:hooks/commit-msg${gitdir}/hooks/remote: Andthenamend the commit:remote:gitcommit --amend

如上所示,依次在项目路径下输入如下命令,即可解决:

gitdir=$(gitrev-parse --git-dir);# 将xxxxx@xxxx 替换成相应用户名、服务器即可(该命令从服务器拷贝commit-msg文件)scp-p -P 29418 xxxxx@xxxx:hooks/commit-msg${gitdir}/hooks/# 再提交一次即可生成change-idgitcommit --amend

你可能感兴趣的:(Git missing Change-Id in commit message footer解决方法)