Last active
January 26, 2017 13:40
-
-
Save simonhayward/6760235666515113ba20 to your computer and use it in GitHub Desktop.
windows cygwin .bashrc - ssh-add
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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