gpg:签名失败:没有 pinentry

rag*_*lin 16 gnupg macos

我正在尝试在 MAC OS 11.2.1 上设置我的 gnupg 配置

到目前为止,我已经设置了我的 SSH,我已经生成了我的 GPG 密钥并将其添加到 GPG 代理中。

现在,如果我运行这个命令:

 echo "test" | gpg --clearsign
Run Code Online (Sandbox Code Playgroud)

我得到这个结果:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

test
gpg: signing failed: No pinentry
gpg: [stdin]: clear-sign failed: No pinentry
Run Code Online (Sandbox Code Playgroud)

问题是,安装了pinetry:

pinentry-curses (pinentry) 1.1.1
Copyright (C) 2016 g10 Code GmbH
License GPLv2+: GNU GPL version 2 or later <https://www.gnu.org/licenses/>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Run Code Online (Sandbox Code Playgroud)

在我的 gpg-agent.conf 文件中,我有这一行:

pinentry-program /usr/local/bin/pinentry-mac
Run Code Online (Sandbox Code Playgroud)

在我的 gpg.conf 我有这一行:

no-tty
Run Code Online (Sandbox Code Playgroud)

gpg 版本:

gpg (GnuPG) 2.2.27
libgcrypt 1.9.2
Copyright (C) 2021 Free Software Foundation, Inc.
License GNU GPL-3.0-or-later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: /Users/usr/.gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
        CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2
Run Code Online (Sandbox Code Playgroud)

我曾多次尝试杀死 gpg 代理并重新安装 gnupg,重新安装 pinentry。没有任何帮助。

rag*_*lin 12

命令

brew install pinentry
Run Code Online (Sandbox Code Playgroud)

Aparrently 将 pinentry 安装到与 gpg-agent.conf 文件不同的路径中。如果有人遇到这个问题,就做

which pinentry-mac
Run Code Online (Sandbox Code Playgroud)

以及它给你的路径,放入 gpg-agent.conf 文件中。

gpgconf --kill gpg-agent更改conf文件后运行非常重要。感谢Jérémie Boulay

  • 哦!使用这个命令后它终于工作了:`gpgconf --kill gpg-agent`。也许之前的 gpg-agent 没有考虑到 pinentry 升级。 (26认同)
  • 您的意思是“brew install pinentry-mac”吗? (3认同)