当使用带有 git tag -u 的 gpg-agent 时,我立即收到以下错误:
gpg: cancelled by user
gpg: skipped "my@email.com": bad passphrase
gpg: signing failed: bad passphrase
error: gpg failed to sign the data
error: unable to sign the tag
Run Code Online (Sandbox Code Playgroud)
gpg-agent.conf:
pinentry-program /usr/bin/pinentry-curses
Run Code Online (Sandbox Code Playgroud)
当我首先解锁钥匙时(通过 a gpg -e -s test.txt),然后git tag -u命令会按预期拿起钥匙并签署标签。
这是在 ubuntu 13.10 上,使用 i3 wm。我怀疑 gnome-keyring 以某种方式阻碍了......某事,但在树莓派上,运行 archlinux-arm,它的工作方式相同,但问题略有不同 - 运行git tag -u命令后,它要求解锁密码,但没有出现密码或提示。一段时间后(大约 30 秒),它失败并显示以下内容:
gpg: problem with the agent: Line passed to IPC too long
gpg: skipped "my@email.com": Operation cancelled
gpg: signing failed: Operation cancelled
error: gpg failed to sign the data
error: unable to sign the tag
Run Code Online (Sandbox Code Playgroud)
同样,一旦我直接将密钥解锁gpg -s到任意文件以缓存 gpg-agent 中的凭据,标签就会被签名而没有问题。
我的假设是我对 pinentry-curses 的使用有些奇怪。我已经更新/usr/bin/pinentry 指向/usr/bin/pinentry-curses,但问题仍然存在。
我做错了什么,我如何让 git 与 gpg/pinentry 一起玩?
编辑:运行 zsh。以下是 gpg 代理的相关位:
if [ $EUID -ne 0 ] ; then
envfile="$HOME/.gnupg/gpg-agent.env"
if [[ -e "$envfile" ]] && kill -0 $(grep GPG_AGENT_INFO "$envfile" | cut -d: -f 2) 2>/dev/null; then
eval "$(cat "$envfile")"
else
eval "$(gpg-agent --daemon --write-env-file "$envfile")"
fi
export GPG_AGENT_INFO # the env file does not contain the export statement
fi
Run Code Online (Sandbox Code Playgroud)
当我关注 $(tty) (例如/dev/pts/16:)时,所有权已经是user:tty.
小智 4
每次启动新的 TTY 时,您还需要导出GPG_TTY变量(也可以从 bash/zsh rc 文件完成):
export GPG_TTY=$(tty)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3174 次 |
| 最近记录: |