Skip to content

Instantly share code, notes, and snippets.

@simonhayward
Last active January 26, 2017 13:40
Show Gist options
  • Save simonhayward/6760235666515113ba20 to your computer and use it in GitHub Desktop.
Save simonhayward/6760235666515113ba20 to your computer and use it in GitHub Desktop.
windows cygwin .bashrc - ssh-add
export SSH_AUTH_SOCK=/home/simon/.ssh-socket
ssh-add -l >/dev/null 2>&1
if [ $? = 2 ]; then
# No ssh-agent running
rm -rf $SSH_AUTH_SOCK
# >| allows output redirection to over-write files if no clobber is set
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment