【发布时间】:2016-03-13 15:43:51
【问题描述】:
多年来,我一直在尝试将库部署到 clojars,而无需使用 lein deploy clojars 指定用户名和密码。但我最终得到以下错误消息:
gpg: gpg-agent is not available in this session
gpg: can't query passphrase in batch mode
gpg: Invalid passphrase; please try again ...
gpg: can't query passphrase in batch mode
gpg: Invalid passphrase; please try again ...
gpg: can't query passphrase in batch mode
gpg: decryption failed: secret key not available
Could not decrypt credentials from /Users/johan/.lein/credentials.clj.gpg
nil
See `lein help gpg` for how to install gpg.
No credentials found for clojars
See `lein help deploying` for how to configure credentials to avoid prompts.
我的~./lein/credentials.clj.gpg 看起来像这样(未加密):
{ #"https://clojars.org/repo"
{:username "<username>" :password "<password>"}}}
我知道用户名和密码是正确的(它们只是从 1password 复制而来)。
运行gpg --list-keys 给了我:
/Users/myname/.gnupg/pubring.gpg
-------------------------------
pub 2048R/0486A2C5 2010-10-12
uid My Name <myname@somemail.com>
sub 2048R/0617110A 2010-10-12
我尝试在 ~/.lein/profiles.clj (:signing {:gpg-key "<key>"}) 中同时指定 0486A2C5 和 0617110A,但没有任何区别。
我还确保 use-agent 在 ~/.gnupg/gpg.conf 中未注释,并且我还确保 gpg-agent 已安装在我的机器上 (brew install gpg-agent)。
更新 1
运行gpg --list-secret-keys 给了我:
/Users/myname/.gnupg/secring.gpg
-------------------------------
sec 2048R/0486A2C5 2010-10-12
uid My Name <myname@somemail.com>
ssb 2048R/0617110A 2010-10-12
运行 gpg --quiet --batch --decrypt ~/.lein/credentials.clj.gpg 提示我输入密码,然后产生未加密的结果。
更新 2
我在 Mac OS X El Capitan 上使用 gpg 1.4.20 和 gpg-agent 2.0.29(均使用 brew 安装)。
我错过了什么!?
【问题讨论】:
-
你能提供调用 GnuPG 的完整命令行吗? GnuPG 可以在另一个用户的上下文中运行吗?
gpg --list-keys打印公钥,解密需要秘钥。gpg --list-secret-keys的输出是什么? -
我已经更新了问题
-
lein运行时无法提示输入密码,所以需要代理。是通过同一个 TTY 提示还是通过 GUI 弹出窗口提示?
-
终端中有一些 ascii ui 所以我想是 tty
-
好的,如果我先执行“gpg --quiet --batch --decrypt ~/.lein/credentials.clj.gpg”然后运行“lein deploy clojars”,它似乎可以工作。但是,如果我在命令之间等待太久,它将不起作用。这是为什么!?