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啦,搜了好久才找到这个解决方案,完美