我正在尝试开始签署 Git 提交。我使用 keybase.io 设置了一个 GPG key ,并将其同步到我的本地计算机和我的 Git 服务器上。现在,我正在尝试解决在每次提交 时输入 key 密码的问题。
PS> git commit -m "testing" --allow-empty
You need a passphrase to unlock the secret key for
user: "keybase.io/anthonymastrean <anthonymastrean@keybase.io>"
2048-bit RSA key, ID AD9184C0, created 2015-04-14 (main key ID 293FEB8B)
Enter passphrase:
据我了解,我需要安装 gpg-agent 之类的东西。我在 Windows 10 Pro 1803 上,所以我正在查看 Gpg4win (由 GitHub 和其他人推荐)。我通过 Chocolatey 安装了它, 所以我有完整的默认安装。
但是,我不知道如何让 gpg-agent 开始缓存我的密码。每次提交时都会提示我。
gpg-agent 说它正在运行
PS> gpg-agent
gpg-agent[4644]: gpg-agent running and available
我有这个 gpg-connect-agent 东西,但我不知道用它做什么。
PS> gpg-connect-agent.exe
> help
# NOP
# CANCEL
# OPTION
# BYE
# AUTH
# RESET
# END
# HELP
# GETEVENTCOUNTER
# ISTRUSTED <hexstring_with_fingerprint>
# HAVEKEY <hexstrings_with_keygrips>
# KEYINFO [--[ssh-]list] [--data] [--ssh-fpr] [--with-ssh] <keygrip>
# SIGKEY <hexstring_with_keygrip>
# SETKEY
# SETKEYDESC plus_percent_escaped_string
# SETHASH (--hash=<name>)|(<algonumber>) <hexstring>
# PKSIGN [<options>] [<cache_nonce>]
# PKDECRYPT [<options>]
# GENKEY [--no-protection] [--preset] [--inq-passwd]
# READKEY <hexstring_with_keygrip>
# GET_PASSPHRASE [--data] [--check] [--no-ask] [--repeat[=N]]
# PRESET_PASSPHRASE [--inquire] <string_or_keygrip> <timeout> [<hexstring>]
# CLEAR_PASSPHRASE [--mode=normal] <cache_id>
# GET_CONFIRMATION <description>
# LISTTRUSTED
# MARKTRUSTED <hexstring_with_fingerprint> <flag> <display_name>
# LEARN [--send] [--sendinfo] [--force]
# PASSWD [--cache-nonce=<c>] [--passwd-nonce=<s>] [--preset]
# INPUT
# OUTPUT
# SCD <commands to pass to the scdaemon>
# KEYWRAP_KEY [--clear] <mode>
# IMPORT_KEY [--unattended] [--force] [<cache_nonce>]
# EXPORT_KEY [--cache-nonce=<nonce>] [--openpgp] <hexstring_with_keygrip>
# DELETE_KEY [--force|--stub-only] <hexstring_with_keygrip>
# GETVAL <key>
# PUTVAL <key> [<percent_escaped_value>]
# UPDATESTARTUPTTY
# KILLAGENT
# RELOADAGENT
# GETINFO <what>
# KEYTOCARD [--force] <hexstring_with_keygrip> <serialno> <id> <timestamp>
OK
我看到手册页讨论了如何在 Bash session 中启动 gpg-agent,但我不确定如何将其转换为 Windows 并让它在 cmd.exe 和 PowerShell 中工作。
最佳答案
您可以使用
gpgconf --launch gpg-agent
让 gpg-agent 在 Windows 后台运行。为了让 gpg-agent 在我登录时自动运行,我在任务计划程序中添加了一个任务:
要扩展密码的到期时间,请将这些行添加到 gpg-agent.conf:
default-cache-ttl 34560000 max-cache-ttl 34560000
我试过把号码设置成999999999,但是一点用都没有
您可以使用以下命令找到 gpg-agent.conf 的位置:
$ gpgconf.exe --list-dirs
sysconfdir:C%3a\ProgramData\GNU\etc\gnupg
bindir:C%3a\Program Files (x86)\GnuPG\bin
libexecdir:C%3a\Program Files (x86)\GnuPG\bin
libdir:C%3a\Program Files (x86)\GnuPG\lib\gnupg
datadir:C%3a\Program Files (x86)\GnuPG\share\gnupg
localedir:C%3a\Program Files (x86)\GnuPG\share\locale
socketdir:C%3a\Users\Jerry\AppData\Roaming\gnupg
dirmngr-socket:C%3a\Users\Jerry\AppData\Roaming\gnupg\S.dirmngr
agent-ssh-socket:C%3a\Users\Jerry\AppData\Roaming\gnupg\S.gpg-agent.ssh
agent-extra-socket:C%3a\Users\Jerry\AppData\Roaming\gnupg\S.gpg-agent.extra
agent-browser-socket:C%3a\Users\Jerry\AppData\Roaming\gnupg\S.gpg-agent.browser
agent-socket:C%3a\Users\Jerry\AppData\Roaming\gnupg\S.gpg-agent
homedir:C%3a\Users\Jerry\AppData\Roaming\gnupg
gpg-agent.conf 在 homedir 中
关于windows - 如何在 Windows 上安装和使用 gpg-agent?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50332885/