GPG-agent

Error:
... the gpg-agent is not available in this session...

Description:
When running some application and triggering the gpg command to decrypt a password, the error message is displayed and the password input appears. Expected behaviour is to use the gpg-agent to retrieve the password. Setting the TTY environment variable in .bashrc did not help.

Solution:
The problem is in a version mismatch between gpg and gpg-agent. While gpg is on eg. version 1.7, the gpg-agent is running on version 2.xxx. Switch over to gpg2 to approach the same source version, import the required private keys into gpg2 and try again.

Import/Export

Source

gpg --list-keys
....
gpg --output outputfile_pub.gpg --armor --export ******
gpg --output outputfile_sec.gpg --armor --export-secret-key *****
gpg --import outputfile_pub.gpg
gpg --import outputfile_sec.gpg

Trusting

Source

Simple, but easy to forget:

$ gpg --edit-key $key gpg> trust ..... gpg> save