Monday, April 13, 2009

NetBeans, Subversion and plink revisited

An earlier post detailed some issues with NetBeans bundled SVN+SSH support. NetBeans allows specifying a different SSH connection command-line (e.g. for plink) for different Subversion URLs - e.g. to set the username, password or other custom connection options; the problem is that it does not actually use that setting after first restart. Instead, a central Subversion config file is consulted; the connection options from there are used for every Subversion URL. That's probably a bug.

The work-around so far has been to just put the settings in the central file. But of course that stops working the moment there is more than one Subversion URL used. Here is my new solution when using plink.exe.

In the central Subversion config file, specify the command-line of "<..path..>\plink.exe -batch -load"; firstly, that turns off interactive prompt (and hence annoying hangs), and also makes plink interpret hostnames passed by Subversion as PuTTY session names! The next step is to set up a PuTTY session named after that host and put all the appropriate settings there - the auto-login username, the private key for authentication, etc.

NOTE: this allows using arbitrary "fake" hostnames in Subversion URLs, as long as they correspond to a PuTTY session.

NOTE: the "-load" option magically works here because the first parameter passed by Subversion after it is the hostname; if that was not the case, the above would fail.

Unix/Linux SSH users, of course, have always had the option to use session names as pseudo-hostnames - without the "-load" option hackery. But this would not even come up if not for the NetBeans bug.