How to make gpg find gpg-agent

Looking at the versions reveals the problem:

% gpg-agent --version
gpg-agent (GnuPG) 2.1.7

% gpg --version                                                               
gpg (GnuPG) 1.4.19

The components come from different packages (gnupg2-2.1.7-1.fc22.x86_64 and gnupg-1.4.19-2.fc22.x86_64 in my case). The solution is to use the gpg2 command instead of gpg.

In case it's helpful for some, gpg 1.4 can work just fine with gpg-agent 2.1.

When looking into it, I found this post:

The agent is compatible, but no longer exports the environment variables that the older version of gpg expects. If you set those manually it will just work:

export GPG_AGENT_INFO=${HOME}/.gnupg/S.gpg-agent:0:1


Gpg Agent