我想开始给 Git 提交签名。我使用 keybase.io 设置了 GPG 密钥,并在本地机器和 Git 服务器上同步了它。现在,我正在尝试解决每次提交时都要输入密钥密码的问题。
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会话中启动gpg-agent,但我不确定如何将其翻译成Windows并使其适用于cmd.exe和PowerShell。 https://linux.die.net/man/1/gpg-agent