Last modified: Mar, 2012
Cygwin is an excellent Unix emulating environment in Windows.
However, ssh-agent doesn’t naturally run in Cygwin shell. Here are some treaks to get it work.
export SSH_AUTH_SOCK=/tmp/.ssh-socket
ssh-add -l 2>&1 >/dev/null
if [ $? = 2 ]; then
# Exit status 2 means couldn't connect to ssh-agent; start one now
ssh-agent -a $SSH_AUTH_SOCK >/tmp/.ssh-script
. /tmp/.ssh-script
echo $SSH_AGENT_PID >/tmp/.ssh-agent-pid
fi
function kill-agent {
pid=`cat /tmp/.ssh-agent-pid`
kill $pid
}
ssh-add
It is quite handy if adding Cygwin terminal to the right click menu. Here is how.
1.Install ‘chere’ package in Cygwin by running its “setup.exe”.
2.Open a Cygwin terminal as the Administrator(right click, and “run as Administrator”), and type
chere -i
to install chere to the right-click menu.
Now right click on any folder and there will be “Bash prompt here”. (Note that right click on an empty space will not give “Bash prompt here”.)