Skip to content

Instantly share code, notes, and snippets.

@akesterson
Created July 15, 2013 13:13
Show Gist options
  • Save akesterson/5999828 to your computer and use it in GitHub Desktop.
Save akesterson/5999828 to your computer and use it in GitHub Desktop.
if [ -f ~/.ssh-agent ]; then
. ~/.ssh-agent
if [ ! -e $SSH_AUTH_SOCK ] || [ "$(pgrep ssh-agent | grep $SSH_AGENT_PID)" == "" ]; then
echo "Stale ~/.ssh-agent file, ssh agent appears to be dead"
ssh-agent > ~/.ssh-agent
. ~/.ssh-agent
ssh-add
fi
else
ssh-agent > ~/.ssh-agent
. ~/.ssh-agent
ssh-add
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment