Setting up ssh-agent for bash under windows

The bash shell for windows is a good extension to use git unter windows. But if you use ssh-based connections it is frustating to enter the passphrase for each connection.

Activating the ssh-agent solve this problem. Create the file .profile in your bash home directory and after starting the bash shell it also starts the ssh-agent and asks once for your ssh passphrase. The passphrase is cached in the ssh-agent during your bash session.

#!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

NetBeans CVS access with SSH

If your ssh key is secured with a password you need to run a ssh agent (e.g. PuTTY agent) on your client machine, because NetBeans has no support for ssh passwords.

Enter your CVS_ROOT in the following syntax:

:ext:<user>@<host>:<path-to-cvsroot>

You must use external shell command to execute ssh, e.g. for Putty under windows environment:

C:\Program files\Putty\plink.exe -ssh -i <path-to-ssh-keyfile>