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
相关推荐
sunny_liangzilong5 小时前
为何 git 默认是 master分支,而github默认是main分支(DeepSeek问答)
git·github
yangshuo12816 小时前
git安装flutter
git·flutter
16年上任的CTO7 小时前
git基础使用--4---git分支和使用
git·gitee·git分支
16年上任的CTO7 小时前
git基础使用--1--版本控制的基本概念
git·gitee·版本控制
wdxylb10 小时前
GIt使用笔记大全
笔记·git·elasticsearch
maply1 天前
VSCode 中的 Git Graph扩展使用详解
ide·git·vscode·编辑器·扩展
行十万里人生1 天前
Qt事件处理:理解处理器、过滤器与事件系统
开发语言·git·qt·华为od·华为·华为云·harmonyos
会敲代码的Steve1 天前
git笔记-简单入门
笔记·git
画船听雨眠aa1 天前
gitlab云服务器配置
服务器·git·elasticsearch·gitlab
Tangcan-2 天前
Linux中基础开发工具(yum,vim,gcc/g++,git,gdb/cgdb)
linux·git·vim