When I do git commit -a -S -m "Commit Message"
, I get this error:
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
But, it doesn't even ask/prompts for my passphrase when I commit. So, how and where do I enter my passphrase while using gpg's -S
flag?
I had the similar thing. I had the gpg and gpg2 binaries, both pointing to GPG version 2.0.30. I wasn't being prompted for my passphrase.
In your bash profile (I did it in my .zshrc file) add the following line:
export GPG_TTY=$(tty)
It stopped prompting me, so I had to kill the daemon
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
then
sudo kill -9 3129
Then it worked. It may be a slightly different issue.
If you are using OSX. It seems like a gpg update (of brew) changed to location of gpg to gpg1, you can change the binary where git looks up the gpg:
git config --global gpg.program gpg1
See this medium blog post .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.