From fd934cbff32710387f024e856a0f5f758aceee10 Mon Sep 17 00:00:00 2001 From: Marko Korhonen Date: Thu, 17 Dec 2020 00:08:23 +0200 Subject: [PATCH] Only set SSH_AUTH_SOCK if not logging in over SSH --- home/.config/zsh/01-env.zsh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/home/.config/zsh/01-env.zsh b/home/.config/zsh/01-env.zsh index 5289a9a..d2899fa 100644 --- a/home/.config/zsh/01-env.zsh +++ b/home/.config/zsh/01-env.zsh @@ -34,10 +34,14 @@ export DOTREPO="$HOME/git/dotfiles" export EDITOR=nvim export PAGER="nvimpager -p" -# use gpg for ssh +# Use GPG for SSH authentication export GPG_TTY="$(tty)" -export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) -gpgconf --launch gpg-agent + +# set SSH_AUTH_SOCK if not logging in over SSH +if [ "$SSH_CONNECTION" != "" ]; then + export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) + gpgconf --launch gpg-agent +fi # tehfuk eval $(thefuck --alias)