繁体   English   中英

Git没有问我gpg密码短语而且我的提交失败了

[英]Git does not ask me for gpg passphrase and fails my commit

当我执行git commit -a -S -m "Commit Message" ,我收到此错误:

You need a passphrase to unlock the secret key for
user: "Username (Gpg Key) <email-id>"
2048-bit RSA key, ID 2487BE7C, created 2016-10-03

error: gpg failed to sign the data
fatal: failed to write commit object

但是,当我提交时,它甚至不会询问/提示我的密码。 那么,在使用gpg的-S标志时,如何以及在何处输入我的密码?

我有类似的事情。 我有gpg和gpg2二进制文件,都指向GPG版本2.0.30。 我没有被提示输入密码。

在你的bash配置文件中(我在我的.zshrc文件中完成)添加以下行:

export GPG_TTY=$(tty)

它停止提示我,所以我不得不杀死守护进程

ps aux | grep gpg
mark              3129   0.0  0.0  4397952    820   ??  Ss    8Mar19   0:28.84 gpg-agent --homedir /Users/Mark/.gnupg --use-standard-socket --daemon
mark             18137   0.0  0.0  4286492    848 s000  R+    3:43pm   0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn gpg

然后

sudo kill -9 3129

然后它奏效了。 这可能是一个稍微不同的问题。

如果您使用的是OSX。 似乎gpg更新(brew)更改为gpg到gpg1的位置,你可以更改git查找gpg的二进制文件:

git config --global gpg.program gpg1

请参阅此媒体博客文章

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM