Using Subversion and Eclipse in Windows
The process of setting up Subversion in Eclipse under Windows is rather convoluted compared to how straighforward it was in linux, which makes me I wonder if I’m not doing something wrong. Nonetheless, here’s how it works for me.
In a nutshell,
- Install Subclipse
- Install JavaSVN or Subversion command line binaries
- Configure SVN in Eclipse
- Install Tortoisesvn
- Download PuTTY binaries
- Set SVN_SSH variable to use TortoisePlink
- Generate or import private key with PuTTYgen
- Load Pageant with key / create startup script
Simple enough, huh?
Here comes the more verbosed version…
Install Eclipse Subversion Plugin
First install Subclipse, the subversion plugin in Eclipse, by adding update site: http://subclipse.tigris.org/update.
Install SVN
We now need to choose a SVN interface. You can either use the JNI or command line interface to SVN. To use JNI install JavaSVN (update site: http://tmate.org/svn/), for command line download windows binaries from http://subversion.tigris.org/. Configure Eclipse to use the installed SVN interface under Window->Preferences->Team->SVN->SVN interface.
Install SSH client for Subversion
Next we need to install and configure a SSH client for Subversion. Download PuTTY, choose the zip containing all the binaries. We can just use plink from PuTTY as the SSH client, or as I prefer, Tortoiseplink from TortoiseSVN, which is based on plink, but with GUI (or the lack of when we don’t need windows popping up).
We need to tell Subversion to use the SSH client, this is done via the SVN_SSH environment variable. Right click on My Computer->Properties->Advanced->Environment Variables->New->name=SVN_SSH and value=C:/Program Files/TortoiseSVN/bin/TortoisePlink.exe. BTW, you need to use '/' not '\' or it doesn’t work, strange given this is the linux convention.
Save Key
Last step is to save your private key in PuTTY so it doesn’t prompt for password everytime. Run PuTTYgen and generate a public/private key pair or load your existing private key file (remember to select the type of key in parameters before you load it). I imported my DSA key from ssh in linux so I won’t have the problem of conflicting key for the same machine. Once loaded, we need to save the key in the format PuTTY can handle.
We need to transfer the saved public key to the SVN server and add it to the list of authorized keys. Locally we need to run PuTTY’s Pageant and add the saved private key file by right clicking on the Pageant icon in system tray (or save a putty session to the SVN server with the private key). Pageant doesn’t maintain it’s state, so we need to areate a startup script to launch peagent with key:
@Echo Off start C:\Utilities\pageant.exe "C:\Documents and Settings\ach\.ssh\key.ppk"
Now when you start windows pageant will automatically start with your key.
Add SVN repository in Eclipse
Try updating a SVN project in Eclipse and fingers crossed it should work!
4 Responses to “Using Subversion and Eclipse in Windows”
Leave a Reply
You must be logged in to post a comment.
July 6th, 2005 at 11:37 pm
Thanks for the info. I linked you from my blog.
July 6th, 2005 at 11:55 pm
I needed to modify your setup slightly. I had to change TortoiseSVN’s network settings and SVN_SSH to use: TortoisePlink.exe -l valid_username -A
TortoiseSVN works like this but I’m still having minor problems with Subclipse.
July 7th, 2005 at 12:38 am
Actually, I can’t get Subclipse working at all in Windows with either plink or TortoisePlink… can you post more detailed instructions for setting up the Windows client-side?
July 7th, 2005 at 12:46 am
I’m sorry for the spam, but I found the problem. It was something having to do with the / and \’s in my SVN_SSH environment variable. I tried /’s, \’s, and enclosing the command in “’s however I was still getting cryptic errors from Subclipse. It worked when I added plink to my PATH and then set the SVN_SSH variable as:
SVN_SSH=plink -l username -A