summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson@vistahigherlearning.com>2015-06-10 08:15:47 -0400
committerDavid Thompson <dthompson@vistahigherlearning.com>2015-06-10 08:15:47 -0400
commita2885eefc22513329c01ca86c8e2c43c440e17fc (patch)
tree4a102170f3051a3f68cb75016d70f187bb125db6
parent97529de2f54a0aaa7eb2ecb4a23dd94b43d9639d (diff)
bash: Respect SSH agent forwarding.
-rw-r--r--dotfiles/.bash_profile8
1 files 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"