Skip to content

Instantly share code, notes, and snippets.

@gsomoza
Created January 17, 2013 16:50
Show Gist options
  • Save gsomoza/4557449 to your computer and use it in GitHub Desktop.
Save gsomoza/4557449 to your computer and use it in GitHub Desktop.
SSH Agent in Windows (Git Bash / MinGW)
#!bash.exe
export SSH_AUTH_SOCK=/tmp/.ssh-socket
echo ;
echo Starting connection with ssh-agent...
ssh-add -l 2>&1 >/dev/null
if [ $? = 2 ]; then
rm -f /tmp/.ssh-script /tmp/.ssh-agent-pid /tmp/.ssh-socket
# Exit status 2 means couldn't connect to ssh-agent; start one now
echo Creating new ssh-agent...
ssh-agent -a $SSH_AUTH_SOCK > /tmp/.ssh-script
. /tmp/.ssh-script
echo $SSH_AGENT_PID > /tmp/.ssh-agent-pid
ssh-add;
echo ssh-agent set up successfully.
ssh-add -l
fi
alias la='ls -lah --color'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment