Skip to content

Instantly share code, notes, and snippets.

@rafecolton
Created September 10, 2013 00:15
Show Gist options
  • Save rafecolton/6503312 to your computer and use it in GitHub Desktop.
Save rafecolton/6503312 to your computer and use it in GitHub Desktop.
Keeping your SSH agent around in different sessions.
# export your current socket
echo "export $(env | grep SSH_AUTH_SOCK | head -n 1)" > "$HOME/.ssh/agent.out"
# source that file in your .bash_profile
str='[[ -s "$HOME/.ssh/agent.out" ]] && source ~/.ssh/agent.out'
grep -q "$str" "$HOME/.bash_profile" || echo "$str" >> "$HOME/.bash_profile"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment