By Jim Connors on Feb 19, 2010
Having spent too much time wrestling with the various components required to get NetBeans to access a subversion repository via ssh, I thought it might make sense to jot down a few notes in an effort to save others from such hardships.
NetBeans does have built-in support for CVS, Mercurial and Subversion, but that doesn't mean that these source code revision systems work in a turnkey fashion. In particular, subversion, especially with Windows, does require some work.
1. To start:
Get the latest JDK. At the time of this writing it was JDK 6 update 18
Get the latest version of NetBeans, in this case, NetBeans 6.8. Install it referencing the latest JDK and furthermore, once inside NetBeans, utilize the update manager to make sure all of your modules are the latest and greatest.
2. Upon starting NetBeans, the menu running along the top of the window has a "Team" entry. Click on Team and follow Subversion->Checkout (No, you won't be able to check anything out yet). This will bring up an error window which requires you to install a subversion client.
Selecting the default action, which installs a subversion plugin for NetBeans, didn't result in much success. Instead choose the second option: "Install Subversion Commandline Client". The recommended download for the client points to CollabNet, which is an excellent choice. Unfortunately the version referred to (v 1.5.5 for Windows) may ultimately prove problematic if you're communicating with a subversion repository that's based on a later version. For this exercise, CollabNet Subversion Command-Line Client v1.6.9 (for Windows) was downloaded and installed.
3. Once Subversion is installed, clicking on Team->Subversion->Checkout again will hopefully bring up a second window which requires you fill in two textfields: (1) A repository URL and (2) a tunnel command. Let's focus on the tunnel command first. For windows this requires the equivalent of the Unix/Linux ssh command. To get this functionality download and install a version of the PuTTY software package.
4. Unlike the Collabnet Subversion Client, PuTTY installation does not put the executables of this package into your PATH. Make sure to add the PuTTY path (typically C:\\Program Files\\PuTTY) to your PATH.
5. You'll need to edit a subversion configuration file to specify the tunnel command as follows:
C:\\>cd %APPDATA%\\Subversion C:\\>edit config
Look for the comment that starts like this:
#ssh = $SVN_SSH ssh
Uncomment it and make it look like the statement below. The plink.exe executable is part of the PuTTY software bundle:
ssh = $SVN_SSH plink.exe -l user -pw password
Where user is your remote user name and password is your user's password. You can also use private key authentication if you're uncomfortable with putting your password in the clear, which might look something like:
ssh = $SVN_SSH plink.exe -l user -i C:\\my_private_key.ppk
6. Prior to trying out Netbeans, first connect to your subversion repository via ssh as follows:
C:\\> plink.exe user@host
Prior to running this command, the NetBeans attempt to access the subversion repository hangs, apparently looking for a host fingerprint cache entry. The plink.exe command above accomplishes its creation, once the correct password is entered. In addition, it assures that SSH is correctly set up on your Subversion repository server.
7. Returning to the Team->Subversion->Checkout selection from the main NetBeans window, now it's time to fill in the two textfields. The first entry should look something like this:
Next should come the tunnel command which should be similar to the entry placed in the %APPDATA%\\Subversion\\config file, namely
plink -l user -pw password
Where, again, user is your remote user name and password is this user's password.
8. With information correctly filled in, and assuming your subversion server is correctly configured, you should be able to begin utilizing subversion through ssh with NetBeans. For further information, check out: