GPG says that it needs a passphrase but it actually doesn't
Solution 1:
GnuPG uses gpg-agent
to cache your passphrase. It does require the passphrase for signing (this is a private key operation) and thus prints the message, but does not need to ask you as the passphrase was still cached. Whether and how long the cache works can be configured.
gpg-agent
gpg
checks if there is a running gpg-agent
(or, in newer versions, necessarily starts one). gpg-agent
does (among other things) cache your pass phrase for a given time.
Configuration
This time span can be configured in ~/.gnupg/gpg-agent.conf
, which in my case contains a line
default-cache-ttl 600
to set the cache time to ten minutes (10*60 seconds). Further options are descriped in man gpg-agent
, most options can also be used in gpg-agent.conf
by omitting the leading --
.