From e6f0937525ea7f31443c2100291f75fa9015a92e Mon Sep 17 00:00:00 2001 From: Oscar Najera Date: Mon, 18 Sep 2023 13:07:47 +0200 Subject: ssh agent only on non ssh sessions This is in the case I log into a machine that has its own agent. I want to have my forwarded agent. --- home-dots/dot-bashrc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/home-dots/dot-bashrc b/home-dots/dot-bashrc index ae13f2b..1641221 100644 --- a/home-dots/dot-bashrc +++ b/home-dots/dot-bashrc @@ -68,9 +68,11 @@ PROMPT_COMMAND=__prompt_command export EDITOR='emacsclient' # GPG agent with ssh -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" ]; 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 fi # For python lsp -- cgit v1.2.3