Skip to content

Commit

Permalink
SSH Agent re-use
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanoasis committed Nov 14, 2016
1 parent 8977f70 commit 1a12b77
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions reuse_existing_ssh_agent
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# source: http://www.electricmonk.nl/log/2012/04/24/re-use-existing-ssh-agent-cygwin-et-al/


# If no SSH agent is already running, start one now. Re-use sockets so we never
# have to start more than one session.

export SSH_AUTH_SOCK=/home/Ryan/.ssh-socket

ssh-add -l >/dev/null 2>&1
if [ $? = 2 ]; then
# No ssh-agent running
rm -rf $SSH_AUTH_SOCK
ssh-agent -a $SSH_AUTH_SOCK >/tmp/.ssh-script
source /tmp/.ssh-script
echo $SSH_AGENT_PID > ~/.ssh-agent-pid
rm /tmp/.ssh-script
fi

0 comments on commit 1a12b77

Please sign in to comment.