git push 错误

错误信息

bash 复制代码
git push origin HEAD:refs/for/master
Enumerating objects: 256, done.
Counting objects: 100% (256/256), done.
Delta compression using up to 4 threads
Compressing objects: 100% (225/225), done.
Writing objects: 100% (255/255), 5.86 MiB | 18.98 MiB/s, done.
Total 255 (delta 40), reused 94 (delta 12), pack-reused 0
remote: Resolving deltas: 100% (40/40)
remote: Processing changes: refs: 1, done
remote: ERROR: commit 2491cd0: 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 wangjicong@192.168.0.240: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://192.168.0.240:29418/MeiGLink
 ! [remote rejected]     HEAD -> refs/for/master (commit 2491cd0: missing Change-Id in message footer)
error: failed to push some refs to 'ssh://192.168.0.240:29418/MeiGLink'

解决

需要将上述提示scp -p -P 29418 wangjicong@192.168.0.240:hooks/commit-msg ${gitdir}/hooks/ 中的-p修改为-O(大写字母O)

bash 复制代码
gitdir=$(git rev-parse --git-dir);
scp -O -P 29418 wangjicong@192.168.0.240:hooks/commit-msg ${gitdir}/hooks/
git commit --amend --no-edit
相关推荐
lazy H42 分钟前
从入门到日常开发,一篇文章掌握 Git 核心操作
git·后端·学习·github
zzqssliu8 小时前
煤炉自动代拍系统的队列设计与超时控制机制
git·github
一支绝命钩9 小时前
FPGA工程Git常用操作手册
git
不搞学术柒柒13 小时前
Git新功能完整开发提交流程
git
午安~婉17 小时前
Git中SSH连接
前端·git·gitee
888CC++18 小时前
VS Code Git 工作树:解锁多分支并行开发新体验
git
阿虎儿18 小时前
Git exclude 功能解析
git
隔窗听雨眠19 小时前
VS Code Git工作树:多分支并行开发的完整实践方案
git
^yi20 小时前
【Linux系统编程】快速上手git仓库管理,核心三板斧
git
郝同学今天有进步吗21 小时前
构建 LangGraph Code Review Agent(四):文件过滤与 AnalysisPackage 分包
git·python·ai·code review