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
相关推荐
程序员差不多先生2 小时前
Anthropic 用 5 个月重写了 Git:当 AI Agent 把版本控制系统逼到墙角
人工智能·git·elasticsearch·deepseek v4 pro·kimi k3·glm 5.3·qwen3.7 max
leo_厉锵3 小时前
GIT习题
git
catoop18 小时前
用 Shell 包装函数,让单个命令拥有专属配置
git
Zguigo20 小时前
学会更高效的理解AI的输出?
人工智能·git·ai
鬼手点金1 天前
上下文:Agent 的眼睛
java·前端·人工智能·git·深度学习
guohuang1 天前
让机器人安全失败:点云中断、TF 超时和控制器崩溃怎么测
git·安全·机器人
小道士写程序1 天前
Git 大文件问题解决办法
git
黑泽明Coding1 天前
如何重置git分支,清空分支所有提交历史
git
小堃学编程1 天前
Git远程开发操作指南
git
于眠牧北1 天前
雷电模拟器9/14搭配charles抓取自带浏览器接口9/14
经验分享·笔记·git