'GPG not prompting for passphrase

So up until yesterday gpg was working all fine. But today, it doesn't prompt for passphrase, I just get an empty blinking command line.

I'm using gpg for signing git commits. I thought the problem was with git. But no, if I do echo "test" | gpg --clearsign I get the same than when doing git commit(empty command line not prompting for passphrase).

At first, the error I was getting when doing git commit was

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

But in this thread they said to export GPG_TTY=$(tty) in your bashrc/zshrc if you get that error. That stopped gpg from showing the error error: gpg failed to sign the data but it still doesn't prompt for passphrase.

I can't do anything related to prompting for passphrase, not listing my keys with gpg --list-secret-keys --keyid-format LONG` or anything. I can see my public with no problem. I tried importing my private key again and I get:

gpg: key <KEYID>: "<NAME EMAIL" not changed

And then just a empty command line again.

I have pinentry installed just in case anyone asks.

I don't understand. It was all working fine yesterday! Does anyone knows how to solve this ?



Solution 1:[1]

I had a similar issue, and it turned out the gpg-agent process was hung.

You might try running:

killall gpg-agent

And then re-try:

echo "test" | gpg --clearsign

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Miguel Gualdron