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

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。