# If an auth sock is already set & available, use it.
# This way ssh agent forwarding still works.
-if [ ! -S "${SSH_AUTH_SOCK}" ] ; then
- if type keychain >/dev/null 2>&1 ; then
+if type keychain >/dev/null 2>&1 ; then
+ if [ ! -S "${SSH_AUTH_SOCK}" ] ; then
: ${HOSTNAME:=$(hostname)}
[ -e ~/.keychain/${HOSTNAME}-sh ] && . ~/.keychain/${HOSTNAME}-sh
+ fi
+ if [ -z "${GPG_AGENT_INFO}" ] ; then
+ : ${HOSTNAME:=$(hostname)}
[ -e ~/.keychain/${HOSTNAME}-sh-gpg ] && . ~/.keychain/${HOSTNAME}-sh-gpg
fi
fi