only configure ssh agent if not in ssh session

master
Paul Walko 2019-09-09 20:52:41 -04:00
parent c4b599cacf
commit 9eae3e84d5
1 changed files with 7 additions and 5 deletions

12
zshrc
View File

@ -36,12 +36,14 @@ fi
# GPG/SSH
## Void: Install pcsclite, pcsc-ccid, gnupg2-scdaemon
## Yubico openpgp: https://support.yubico.com/support/solutions/articles/15000006420-using-your-yubikey-with-openpgp
unset SSH_AGENT_PID
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
if [ -z "$SSH_CLIENT" ] || [ -z "$SSH_TTY" ]; then
unset SSH_AGENT_PID
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
fi
export GPG_TTY=$(tty)
gpg-connect-agent updatestartuptty /bye >/dev/null
fi
export GPG_TTY=$(tty)
gpg-connect-agent updatestartuptty /bye >/dev/null
# VIM
## Reduce delay swithing between normal & insert mode