git push提交代码时报ERROR: commit c9e0a5b: missing Change-Id in message footer

已经git add,git commit后,在git push提交代码时出现报错如下,主要原因是缺少Change ID,可以参照提醒gitdir=$(git rev-parse --git-dir); scp -p -P 29418 uluxy181@10.118.234.22:hooks/commit-msg ${gitdir}/hooks/,试着加上ID。
不过本人的开发环境试了,无效。

Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 89.83 KiB | 0 bytes/s, done.
Total 5 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2)
remote: Processing changes: refs: 1, done    
remote: ERROR: commit c9e0a5b: missing Change-Id in message footer
remote: 
remote: Hint: to automatically insert a Change-Id, install the hook:
remote:   gitdir=$(git rev-parse --git-dir); scp -p -P 29418 uluxy181@10.118.234.22:hooks/commit-msg ${gitdir}/hooks/
remote: and then amend the commit:
remote:   git commit --amend --no-edit
remote: Finally, push your changes again
remote: 
To ssh://uluxy181@10.118.234.22:29418/MTK_Android/vendor/yfve/mt2712_saic_touchbar/packages
 ! [remote rejected] HEAD -> refs/for/saic_touchbar (commit c9e0a5b: missing Change-Id in message footer)
error: failed to push some refs to 'ssh://uluxy181@10.118.234.22:29418/MTK_Android/vendor/yfve/mt2712_saic_touchbar/packages'

本人解决办法:
1,到.git仓库下,打开COMMIT_EDITMSG文件,里面确实没有生成Change ID

uluxy181@ubuntu16-010:~/workspace1/touchbar/vendor/yfve/mt2712_saic_touchbar/packages/.git$ ls
COMMIT_EDITMSG  config  description  HEAD  hooks  index  info  logs  MERGE_RR  objects  packed-refs  refs  rr-cache  svn

2,cd到.git/hooks目录,发现commit-msg文件报红,应该是文件丢失

uluxy181@ubuntu16-010:~/workspace1/touchbar/vendor/yfve/mt2712_saic_touchbar/packages/.git/hooks$ ls
applypatch-msg.sample  commit-msg.sample   pre-applypatch.sample  pre-commit.sample          pre-push.sample    update.sample
commit-msg             post-update.sample  pre-auto-gc            prepare-commit-msg.sample  pre-rebase.sample

3,回退刚才git add 和git commit 提交的代码

git reset --soft HEAD^
git reset HEAD .

4,手动删除commit-msg文件,然后重新repo sync

uluxy181@ubuntu16-010:~/workspace1/touchbar/vendor/yfve/mt2712_saic_touchbar/packages$ rm -rf commit-msg

uluxy181@ubuntu16-010:~/workspace1/touchbar/vendor/yfve/mt2712_saic_touchbar/packages$ repo sync

5,这时候重新查看commit-msg文件状态

6,重新提交代码既可

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值