如何禁用git rebase --continue操作的GPG签名功能?
解决Git Rebase时强制GPG签名失败的问题
核心问题原因
git rebase --continue 会沿用rebase启动时的配置,你尝试的--no-gpg-sign是git commit的专属参数,无法直接传递给rebase的continue流程;而中途添加-c commit.gpgSign=false也不会覆盖已启动的rebase会话配置。
可行解决方案
重新启动带禁用签名的rebase(最稳妥)
先中止当前卡住的rebase:git rebase --abort然后重新启动rebase时直接指定禁用签名:
git rebase -c commit.gpgSign=false <你的目标分支>整个rebase过程中生成的新提交都会跳过GPG签名。
临时全局/仓库级禁用签名
如果不想中止当前rebase,先临时关闭全局签名:git config --global commit.gpgSign false执行
git rebase --continue完成操作后,再恢复原配置:git config --global commit.gpgSign true若仓库有单独配置,改用仓库级命令:
git config --local commit.gpgSign false # 完成后恢复 git config --local commit.gpgSign true检查hook脚本强制签名
查看仓库的.git/hooks目录下的commit-msg或pre-commit脚本,若有强制GPG签名的逻辑,临时注释掉相关代码块,完成rebase后再恢复脚本。
内容的提问来源于stack exchange,提问作者Ethan Reesor
相关产品推荐
相关产品推荐

