aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOscar Najera <hi@oscarnajera.com>2023-09-18 13:07:47 +0200
committerOscar Najera <hi@oscarnajera.com>2023-09-18 13:08:03 +0200
commite6f0937525ea7f31443c2100291f75fa9015a92e (patch)
tree7257a2c5f80ee08c5e9b49e9459fc8279b382d6f
parent6ab15660d71e6d1ecc8c850a4c8c4433d604d89a (diff)
downloaddotfiles-e6f0937525ea7f31443c2100291f75fa9015a92e.tar.gz
dotfiles-e6f0937525ea7f31443c2100291f75fa9015a92e.tar.bz2
dotfiles-e6f0937525ea7f31443c2100291f75fa9015a92e.zip
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.
-rw-r--r--home-dots/dot-bashrc8
1 files 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