I like to sign my git commits with my PGP key, so I was quite alarmed when I went to git commit -S
but instead of prompting for my PGP key passphrase, git just started hanging. I haven't made a change to my GPG setup in several months and have made many commits since then with no problem. Additionally, when I attempt to view my private keys with gpg -K
, gpg hangs. However, when I run gpg -k
to view my public keys, it returns the list like normal. Hopefully someone will have some idea of what is causing this problem and how to fix it.
GPG Hangs When Private Keys are Accessed
gitgpgopenpgppgp
Best Answer
I came across this exact issue (OSX Sierra 10.12.6, gpg/GnuPG 2.2.5)
Commands that would hang:
My solution was the same as mentioned by John above (ie. kill gpg-agent) as most other methods on how-can-i-restart-gpg-agent would also hang.
Then for signing git commits I set the tty env as mentioned by cas above and also at gpg-failed-to-sign-commit-object.