缺少commit id 导致 git push failed

问题详情

本地代码提交到gerrit时,git push时出现了一条报错

liuqi@sh-48-113:~/Code/M516_ARM9/Nicobar$ git push origin HEAD:refs/for/LCT_Nicobar.LA.1.0_CS
Counting objects: 17, done.
Delta compression using up to 32 threads.
Compressing objects: 100% (14/14), done.
Writing objects: 100% (17/17), 13.69 MiB | 26.28 MiB/s, done.
Total 17 (delta 8), reused 0 (delta 0)
remote: Resolving deltas: 100% (8/8)
remote: Processing changes: refs: 1, done    
remote: ERROR: [16e1eae] 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 liuqi@172.16.16.121:hooks/commit-msg ${gitdir}/hooks/
remote: And then amend the commit:
remote:   git commit --amend
remote: 
To ssh://172.16.16.121/ARM9/Nicobar
 ! [remote rejected] HEAD -> refs/for/LCT_Nicobar.LA.1.0_CS ([16e1eae] missing Change-Id in commit message footer)
error: failed to push some refs to 'ssh://172.16.16.121/ARM9/Nicobar'

root cause

这个是因为本地缺失了change id导致的。

solution

执行下面指令生成changeid ,并合并到上一次的提交就可以了
这条指令上面报错的时候其实就已经写出来了,直接复制粘贴执行就可以了

gitdir=$(git rev-parse –git-dir); scp -p -P 29418 liuqi@172.16.16.121:hooks/commit-msg ${gitdir}/hooks/
git commit –amend

liuqi@sh-48-113:~/Code/M516_ARM9/Nicobar$  gitdir=$(git rev-parse --git-dir); scp -p -P 29418 liuqi@172.16.16.121:hooks/commit-msg ${gitdir}/hooks/
commit-msg                                   100% 4781     4.7KB/s   00:00    
liuqi@sh-48-113:~/Code/M516_ARM9/Nicobar$  git commit --amend
[LCT_Nicobar.LA.1.0_CS ec32eac] [M521][wifi][HTH-86408]: It is equipped with the function of "mi communication" [root cause]: ble scan cause the wifi sap mode cannot connected to pc [solution]: merge the CR 2653707 [sideeffect]:No [others]:No
 Date: Thu Apr 16 14:06:05 2020 +0800
 9 files changed, 19 insertions(+), 19 deletions(-)
liuqi@sh-48-113:~/Code/M516_ARM9/Nicobar$ git push origin HEAD:refs/for/LCT_Nicobar.LA.1.0_CS
Counting objects: 17, done.
Delta compression using up to 32 threads.
Compressing objects: 100% (14/14), done.
Writing objects: 100% (17/17), 13.69 MiB | 25.25 MiB/s, done.
Total 17 (delta 8), reused 0 (delta 0)
remote: Resolving deltas: 100% (8/8)
remote: Processing changes: new: 1, refs: 1, done    
remote: 
remote: New Changes:
remote:   http://gerrit.longcheer.net/206749 [M521][wifi][HTH-86408]: It is equipped with the function of "mi communicatio...
remote: 
To ssh://172.16.16.121/ARM9/Nicobar
 * [new branch]      HEAD -> refs/for/LCT_Nicobar.LA.1.0_CS

然后使用git push指令就可以将代码推送到gerrit了。

剑气纵横三万里

“为什么要努力?” “想去的地方很远,想要的东西很贵,喜欢的人很优秀,父母的白发,朋友的约定,周围人的嘲笑,以及,天生傲骨。”

留下你的评论

*评论支持代码高亮<pre class="prettyprint linenums">代码</pre>

相关推荐

暂无内容!