我想在没有安装Gpg4win的情况下使用GPG,因为Windows的Git包含了GPG的二进制文件,所以我想使用它而不是安装额外的应用程序。
然而,当我设置GPG(例如添加路径等)时,我遇到了以下错误:
C:Usersme> gpgconf --launch gpg-agent
gpgconf: error running '/usr/bin/gpg-connect-agent': exit status 1
gpgconf: error running '/usr/bin/gpg-connect-agent NOP': General error
与gpg-connect-agent
:
C:Usersme> gpg-connect-agent /bye
gpg-connect-agent: no running gpg-agent - starting '/usr/bin/gpg-agent'
gpg-connect-agent: waiting for the agent to come up ... (5s)
gpg-connect-agent: waiting for the agent to come up ... (4s)
gpg-connect-agent: waiting for the agent to come up ... (3s)
gpg-connect-agent: waiting for the agent to come up ... (2s)
gpg-connect-agent: waiting for the agent to come up ... (1s)
gpg-connect-agent: can't connect to the agent: IPC connect call failed
gpg-connect-agent: error sending standard options: No agent running
我需要代理运行以便签署git提交,所以我不确定发生了什么。
在此错误发生之前,我正在使用Gpg4win,它根本没有错误(为了确保它不是版本问题,我已经删除了%userprofile%/.gnupg
中的所有内容)
系统信息:
Windows 10 21H1 19043.1110
git version 2.29.2.windows.1
C:Usersme> 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/me/.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
where gpg
:C:Program FilesGitusrbingpg.exe
where git
:C:Program FilesGitcmdgit.exe
任何帮助将不胜感激。由于
我在新MacOS (Monterey)上新安装gnupg2时遇到了同样的问题。似乎安装没有创建.gnupg
文件夹。
在我的例子中,这是通过运行:
解决的:gpg -K
导致创建的缺失文件夹
gpg: directory '/Users/xxx/.gnupg' created
gpg: keybox '/Users/xxx/.gnupg/pubring.kbx' created
gpg: /Users/xxx/.gnupg/trustdb.gpg: trustdb created
和一切都很好。
我总算弄明白了。
这是因为git for windows的gpg使用MINGW64
作为环境。由于我手动将GNUPGHOME
环境变量设置为Windows路径:C:/users/me/.gnupg
,因此它将不起作用。
(我从不使用包含的MINGW64
git bash,我只使用cmd并添加那些exe,如git, gpg到PATH
)
因此,如果您手动设置了GNUPGHOME
env变量,则需要更改为MINGW64
路径。
在我的例子中,C:/users/me/.gnupg
->/c/users/me/.gnupg
我不确定--homedir
虽然。