From a2885eefc22513329c01ca86c8e2c43c440e17fc Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 10 Jun 2015 08:15:47 -0400 Subject: bash: Respect SSH agent forwarding. --- dotfiles/.bash_profile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dotfiles/.bash_profile b/dotfiles/.bash_profile index 9334ce0..ff1ce98 100644 --- a/dotfiles/.bash_profile +++ b/dotfiles/.bash_profile @@ -16,8 +16,12 @@ if [ -f ~/.bashrc ]; then . ~/.bashrc; fi # Search for binaries in user profile /sbin. export PATH="$HOME/.guix-profile/sbin:$PATH" -# SSH agent. -export SSH_AUTH_SOCK="$HOME/.gnupg/S.gpg-agent.ssh" +# Only configure the SSH agent if we're not in an SSH session with a +# forwarded agent. +if ! [ -n "$SSH_CLIENT" -a -n "$SSH_AUTH_SOCK" ] +then + export SSH_AUTH_SOCK="$HOME/.gnupg/S.gpg-agent.ssh" +fi # Ruby. export GEM_PATH="$HOME/.guix-profile/lib/ruby/gems/2.2.0" -- cgit v1.2.3