微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

GPG 在 git commit 期间失败

如何解决GPG 在 git commit 期间失败

我在我的本地机器上设置了 gpg,并且大部分时间它都可以工作。但有时提交需要大约一分钟,然后失败。提交某事时,我只得到输出

gpg: DBG: Not using CREATE_BREAKAWAY_FROM_JOB flag
gpg: can't connect to the agent: IPC connect call Failed
gpg: keydb_search Failed: No agent running
gpg: skipped "<mykeyid>": No agent running
gpg: signing Failed: No agent running
error: gpg Failed to sign the data
fatal: Failed to write commit object

所以我想可能没有 gpg 代理在运行,于是我启动了一个

>gpg-agent --daemon --verbose
gpg-agent: a gpg-agent is already running - not starting a new one

有人在不同的线程上建议可能我的 gpg 版本不匹配或针对不同的安装:

>gpg --version
gpg (GnuPG) 2.2.23-unkNown
libgcrypt 1.8.7
copyright (C) 2020 Free Software Foundation,Inc.
License GPLv3+: GNU GPL version 3 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: /c/Users/micha/.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

>gpg-agent --version
gpg-agent (GnuPG) 2.2.23-unkNown
libgcrypt 1.8.7
copyright (C) 2020 Free Software Foundation,to the extent permitted by law.

所以版本好像是一样的,安装目录好像也没问题:

>which gpg
/usr/bin/gpg

>which gpg-agent
/usr/bin/gpg-agent

有关其他信息:我使用 gpg4win 3.1.16 运行 Windows 10,使用 sublime merge 或 git cli 提交。

>gpg --list-keys --keyid-format LONG
/c/Users/micha/.gnupg/pubring.kbx
---------------------------------
pub   ed25519/<mykeyid> 2021-03-02 [SCA] [expires: 2023-03-02]
      <someotherid>
uid                 [ unkNown] <mymail1>
uid                 [ unkNown] <mymail2>
sub   cv25519/<someotherid> 2021-03-02 [E] [expires: 2023-03-02]

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。