【问题标题】:Can not commit to sign with gpg2 on Windows 10 (GnuPG)无法在 Windows 10 (GnuPG) 上使用 gpg2 进行签名
【发布时间】:2016-11-26 19:02:59
【问题描述】:

我正在尝试生成密钥并签署提交。我的关键清单:

gpg2 --list-keys:

C:/Users/raski/AppData/Roaming/gnupg/pubring.gpg

------------------------------------------------
pub   2048R/8E3A3251 2016-11-26
uid       [ultimate] My Name <raski@example.com>
sub   2048R/29C8D116 2016-11-26

git config --global -l:

filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.required=true
user.name=roma
user.email=raski@example.com
user.signingkey=8E3A3251
commit.gpgsign=true
gpg.program=D:/Programs/GnuPG/pub/gpg2

我尝试提交:

git commit -m "initial"

之前,我在设置 Github 中添加了我的公共 PGP 密钥。但是,我有错误:

gpg: skipped "2048R/8E3A3251": No secret key
gpg: signing failed: No secret key
error: gpg failed to sign the data
fatal: failed to write commit object

这就是为什么它仍然使用 gpg 而不是 gpg 2,尽管我已经配置了 gpg2 的路径。可能存在什么问题?

【问题讨论】:

  • gpg2 -K(又名gpg2 --list-secret-keys)说什么?你在这里只展示了公众的一半。
  • 我得到同样的错误。 gpg --version 会告诉你 Git Bash 中的旧版本吗?

标签: git github gnupg


【解决方案1】:

这就是为什么它仍然使用 gpg 而不是 gpg 2,尽管我已经配置了 gpg2 的路径。

那是因为 git for windows 本身在其 &lt;git&gt;/usr/bin 文件夹中包含一个 gpg.exe 1.x,供 git 命令使用。

可能存在什么问题?

您需要在&lt;gpg2&gt;\latest\pub 文件夹中将gpg2.exe 复制到gpg.exe,这样PATH 可能实际上在gpg.exe 1.x 之前包含gpg.exe 2.x 来自git .
或者,如果它不起作用,请将&lt;gpg2&gt;\latest\pub\gpg2.exe 复制到&lt;git&gt;/usr/bin/gpg.exe

【讨论】:

    【解决方案2】:

    只需删除&lt;git&gt;/usr/bin下的gpg.exe文件即可。

    【讨论】:

    • 升级 git for windows 时需要记得重新删除gpg.exe
    猜你喜欢
    • 2016-12-12
    • 1970-01-01
    • 1970-01-01
    • 2016-11-02
    • 2015-11-02
    • 2018-11-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多