You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Eclipse Git提交签名报错Failed to parse secret key file如何解决?

Eclipse Git提交签名报错"Failed to parse secret key file"解决方案
  • 排查密钥格式兼容性
    Eclipse内置JGit组件对新版GPG默认生成的ed25519类型密钥适配度较低,优先生成RSA 4096位密钥测试,执行命令gpg --full-generate-key,选择RSA类型、长度设为4096,生成时填写的姓名、邮箱需和Git配置的user.name、user.email完全一致。
  • 补全Git签名核心配置
    执行git config --list --show-origin检查三个核心配置是否正确:
    1. user.signingkey参数值和你生成的GPG密钥ID一致
    2. 新增gpg.program配置指向本地安装的GPG程序路径,避免使用JGit内置GPG实现,示例配置命令:
      • Windows: git config --global gpg.program "C:\Program Files (x86)\gnupg\bin\gpg.exe"
      • macOS: git config --global gpg.program "/usr/local/bin/gpg"
      • Linux: git config --global gpg.program "/usr/bin/gpg"
  • 调整Eclipse Git内置配置
    打开路径:窗口(Window) → 偏好设置(Preferences) → 版本控制(Team) → Git,进入「配置(Configuration)」页确认上述Git全局/仓库配置已被Eclipse正确读取,再进入「GPG」子页,勾选*使用外部GPG可执行文件(Use external GPG executable)*选项。
  • 检查密钥环文件权限
    Windows侧确认用户目录下.gnupg文件夹仅当前用户有读写权限,未被杀毒软件等程序锁定;macOS/Linux侧执行命令修改权限:
    chmod 700 ~/.gnupg
    chmod 600 ~/.gnupg/*
    
  • 版本兼容回退方案
    若上述操作均无效,可确认是当前版本Eclipse的已知Bug,2023-09及之后的部分版本存在JGit GPG解析异常问题,可临时降级到2023-06版本使用,或使用命令行执行git commit -S完成带签名的提交。

内容的提问来源于stack exchange,提问作者Matthew W.

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.07 11:30:01