From 451d745b1982f20fba4768b76392e2383fe5000b Mon Sep 17 00:00:00 2001 From: Scott Wallace Date: Thu, 18 Feb 2016 08:34:38 +0000 Subject: [PATCH 1/2] Change SSH Agent stuff to re-use existing sockets. --- .bashrc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.bashrc b/.bashrc index a3734c3..e6eba0f 100644 --- a/.bashrc +++ b/.bashrc @@ -106,8 +106,13 @@ export GOPATH=${HOME}/src/go #-------------------------------------------------------------------------------- # Check if we already have an agent running and sourced if [ -z "${SSH_AUTH_SOCK}" ]; then - eval `ssh-agent -s` - ssh-add + SSH_AUTH_SOCK_FILE=~/.ssh/auth_sock + if [ -S ${SSH_AUTH_SOCK_FILE} ]; then + SSH_AUTH_SOCK=${SSH_AUTH_SOCK_FILE} + else + eval `ssh-agent -a ${SSH_AUTH_SOCK_FILE} -s` + ssh-add + fi fi #-------------------------------------------------------------------------------- From 98f4757a38865c29a1b0f25373bbd817bf12b2ce Mon Sep 17 00:00:00 2001 From: Scott Wallace Date: Thu, 18 Feb 2016 08:40:56 +0000 Subject: [PATCH 2/2] More SSH Agent playing. --- .bashrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.bashrc b/.bashrc index e6eba0f..6f2fbde 100644 --- a/.bashrc +++ b/.bashrc @@ -108,9 +108,11 @@ export GOPATH=${HOME}/src/go if [ -z "${SSH_AUTH_SOCK}" ]; then SSH_AUTH_SOCK_FILE=~/.ssh/auth_sock if [ -S ${SSH_AUTH_SOCK_FILE} ]; then - SSH_AUTH_SOCK=${SSH_AUTH_SOCK_FILE} + export SSH_AUTH_SOCK=${SSH_AUTH_SOCK_FILE} + export SSH_AGENT_PID=$(cat ~/.ssh/agent.pid) else eval `ssh-agent -a ${SSH_AUTH_SOCK_FILE} -s` + echo ${SSH_AGENT_PID} > ~/.ssh/agent.pid ssh-add fi fi