Check ssh-agent liveness before sourcing GPG_ENV

Resolves issue #2121