git合并代码后无change-id,按提示操作报错subsystem request failed on channel 0 scp: Connection closed 解决方案

git 合并代码后push到gerrit提示

Total 1 (delta 0), reused 0 (delta 0), pack-reused 0
remote: 
remote: Processing changes: refs: 1        
remote: Processing changes: refs: 1, done            
remote: ERROR: commit 990d44a: 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 xxx@gerrit.xxx:hooks/commit-msg ${gitdir}/hooks/        
remote: and then amend the commit:        
remote:   git commit --amend --no-edit        
remote: Finally, push your changes again        
remote: 
error: failed to push some refs to 'ssh://gerrit.xxx'

排查ssh配置正确,代码拉取正常,没有change-id,按照提示在git中输入

$ gitdir=$(git rev-parse --git-dir); scp -p -P 29418 xxx@gerrit.xxx:hooks/commit-msg ${gitdir}/hooks/        

结果报错

subsystem request failed on channel 0
scp: Connection closed

解决方案 scp -p 改为scp -O

$ gitdir=$(git rev-parse --git-dir); scp -O -P 29418 xxx@gerrit.xxx:hooks/commit-msg ${gitdir}/hooks/
commit-msg        

然后

$ git commit --amend --no-edit
[feature/1.0.5 4cc6cf2] Merge branch 'xxx' into xxx Change-Id: xxx
 Date: Tue Oct 31 08:35:09 2023 +0800

现在就可以push啦,搜了好久才找到这个解决方案,完美

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值