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

Daw*_*y33 16 git gnupg

当我这样做时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
Run Code Online (Sandbox Code Playgroud)

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

Die*_*ero 21

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

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

export GPG_TTY=$(tty)


Ram*_*ino 8

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

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
Run Code Online (Sandbox Code Playgroud)

然后

sudo kill -9 3129
Run Code Online (Sandbox Code Playgroud)

然后它起作用了。这可能是一个稍微不同的问题。

  • 这为我解决了这个问题。似乎我以一种错误的方式退出了先前的提示,这使守护程序感到困惑。 (4认同)