D:\code\项目仓库目录>git push origin HEAD:refs/for/dev/wangteng/XXXXX key_load_public: invalid format Enumerating objects: 82, done. Counting objects: 100% (82/82), done. Delta compression using up to 4 threads Compressing objects: 100% (59/59), done. Writing objects: 100% (60/60), 30.61 KiB | 1.91 MiB/s, done. Total 60 (delta 26), reused 0 (delta 0) remote: Resolving deltas: 100% (26/26) remote: Processing changes: refs: 1, done remote: ERROR: missing Change-Id in commit message remote: Suggestion for commit message: remote: 提交的commit备注 remote: remote: Change-Id: I710b3e8e5f92f28cb92e50104437950a20c9e847 To ssh://gerrit-server/sp_edaijia.git ! [remote rejected] HEAD -> refs/for/dev/wangteng/xxxxxx (missing Change-Id in commit message) error: failed to push some refs to 'ssh://gerrit-server/sp_edaijia.git'
git 提交到远程版本库出错:remote: ERROR: missing Change-Id in commit message footer
这里报错其实是因为配置的时候没有获取一个“钩子”的东西,因为本地提交到远程版本库的时候中间还要经过一道审核
解决方法:从服务器获取“钩子”到本地,如:
scp -p -P 8849 远程版本库地址:hooks/c ommit-msg .git/hooks/
我所在的公司是这么定义远程版本仓库地址:wangteng@git.edaijia.cn,那么命令如下
cd <工程名> scp -P 29418 wangteng@git.edaijia.cn:/hooks/commit-msg .git/hooks/ chmod u+x .git/hooks/commit-msg
假如你这次报错是因为你已经add 并且commit ,那么执行一下git reset head^,重新add即可