Skip to content

Instantly share code, notes, and snippets.

@freyes
Created February 26, 2015 15:24
Show Gist options
  • Save freyes/18e67d500557855b8525 to your computer and use it in GitHub Desktop.
Save freyes/18e67d500557855b8525 to your computer and use it in GitHub Desktop.
launch ssh-agent and load env variables
# put this in ~/.bashrc
test -f ~/.ssh/agent && source ~/.ssh/agent > /dev/null
if [ "x$SSH_AGENT_PID" != "x" ]; then
kill -0 $SSH_AGENT_PID || ssh-agent -s -a $HOME/.ssh/agent.socket > ~/.ssh/agent
else
ssh-agent -s -a $HOME/.ssh/agent.socket > ~/.ssh/agent
fi
source ~/.ssh/agent > /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment