二 月
15
水曜日
2017

lein deployでget_passphrase failed

lein deploy clojarscommand get_passphrase failedで失敗する件を調べた。


$ lein deploy clojars
.
.
.
gpg-agent[80019]: command get_passphrase failed: Inappropriate ioctl for device
gpg: problem with the agent: Inappropriate ioctl for device
gpg: no default secret key: Operation cancelled
gpg: signing failed: Operation cancelled

deploy対象が非snapshotである場合は署名付きになるがその際のgpg-agentによるパスフレーズ入力処理で落ちている。

エラーメッセージから気づかなかったが単に環境変数 GPG_TTY の設定が抜けていたのが原因だった模様。 確かにGnuPGのマニュアルにも書いてある。

You should always add the following lines to your .bashrc or whatever initialization file is used for all shell invocations

GPG_TTY=$(tty)
export GPG_TTY