November 27, 2005
HowTo: Configure SVN+SSH with Subclipse on Windows
Problem:
Use ssh tunnelling to access a Subversion repository using SSH tunneling (i.e. with a subversion repository url of svn+ssh://myservername/myrepo) using the Subclipse subversion integration with Eclipse. I tried various things and used each of the three interfaces for configuring Subclipse (Window, Preferences..., Team, SVN).
When I used JavaHL (JNI) I got the following error, "svn: Can't create tunnel: The system cannot find the file specified." SVN Command Line gave me a similar error. Finally the JavaSVN interface (1.0) just did not want to authenticate with my server at all. Did various searches on Google and couldn't find an answer that worked, just lots of people with a similar problem. Anyway, the following works for me...
Solution:
You need to create an environment variable called "SVN_SSH" that points to an executable file that accepts the same command line arguments as ssh on unix. I did this by doing the following:-
- Set up ssh keys. Not going to cover that here as you can easily Google for that. You need to end up with your public key on the SVN server and your private key loaded into Paegent locally.
- Download and installed the excellent TortoiseSVN client for Windows.
- Set the following environment variable (by right-clicking on My Computer, Properties, Advanced, Environment Variables, New):-
Variable name:
SVN_SSH
Variable value:C:\\Program Files\\TortoiseSVN\\bin\\TortoisePlink.exe(The "\\" is very important, otherwise it won't work. Equally, you cannot use the plink.exe that comes with putty as that fires up a command shell window which is really annoying. The TortoisePlink.exe is a windows implementation of plink that doesn't bring up any UI)
- Configure the Subclipse plugin to use JavaHL (JNI)
- Restart Eclipse
- Do a little victory jig (optional)
Posted by Martin at November 27, 2005 12:09 AM
Comments
Hi Martin
Just saw the post about your new job in Illinois - congrats.
Sam (from BT)
Posted by: Sam Judson | November 29, 2005 10:12 AM
What the hell are you on about? :)
Posted by: Jez | December 3, 2005 12:46 AM
I tried the above and it didn't work. What worked for me was editing the Subversion config file, which is at C:\Documents and Settings\\Application Data\Subversion\config.
It's an INI-style file, uncomment the line reading [tunnels] and add the following line underneath it:
ssh = C:\Program Files\TortoiseSVN\bin\TortoisePlink.exe
Obviously you will need to modify the line if you have installed TortoiseSVN somewhere else.
Posted by: John Carney | January 14, 2006 05:24 AM
I tried this method, but still had to enter my password on EACH update.
http://docs.codehaus.org/display/CASTOR/SVN+Access+from+Eclipse+Using+Subclipse
worked for me and does NOT require ANY third part applications.
Posted by: Christopher Yu | May 6, 2006 06:47 PM
Sweet, thanks for the info. I had a similar problem with AnkhSVN and Visual Studio 2005, and the environment variable fixed it.
Posted by: Dust | September 11, 2006 09:44 AM
# Install Subclipse plugin from http://subclipse.tigris.org/ if you have not already installed it.
If you have to enter password you many multiple times like I did (note I have cygwin installed) then follow the below instruction. Might work for you.
# In Eclipse, under Windows --> Preferences --> Team --> SVN --> SVN interface: make sure you have selected JavaSVN.
Now i only have to enter my password once, no errors
Posted by: K123 | September 12, 2006 11:59 AM
Nice! Thanks for the excellent instructions. I did the optional victory jig.
Posted by: anonymous | October 6, 2006 05:12 AM
Thanks for the tip!
For others having problems, I had to generate the key on my server, then use puttygen to convert it to .ppk format (otherwise pageant complains about the OPEN-SSH file type).
Posted by: Louis | November 30, 2006 03:31 PM
Cross link to this post added here:
http://confluence.public.thoughtworks.org/display/CCNET/Subversion+Source+Control+Block
Posted by: Dmitry Makhno | February 12, 2007 12:50 PM
Hi Martin,
I've just been dabbling with Subclipse and was having problems with svn+ssh repositories .. your instructions here worked a treat to get things going.
Thanks,
-stephen
Posted by: Stephen Mulcahy | February 14, 2007 09:04 PM
I used PuTTY's "plink" component -- which I already had installed in C:\opt -- instead of installing TortoiseSVN. It was pretty easy, and it works seamlessly with the Pageant authentication agent too:
[tunnels]
ssh = c:\\opt\\plink.exe
Posted by: Jason McVetta | March 5, 2007 05:45 PM
Hi Jason,
The advantage of the plink that comes with TortoiseSVN is that it doen't fire up a command shell when run. In the version of Plink that I had with my Putty installation it kept firing up a command window when connecting - while I was able to get that window to run minimized, it was still annoying for me.
Did you not have that problem? I'm wondering if the Putty plink has changed recently?
M.
Posted by: Martin Woodward | March 6, 2007 08:56 AM
All of this configuration work, other than generating keys, is unnecessary.
Just use the Pure Java SSH provider instead of the JNI one. Just like with JDBC drivers, if a pure Java product will do what you want, everything is much easier.
I've helped people use Svn with Eclipse for years, and the pure driver ssh providers are always better.
Posted by: Blaine Simpson | March 21, 2007 02:39 AM
Thanks for taking the time to post this. This fixed the Subclipse problem I was having.
Posted by: Glen Mazza | April 12, 2007 03:12 PM
This is the best discussion on the tunnel error about svn. The 'pure java' solution works for me. What I did is: in Eclipse, Windows->Preferences->Team->SVN->svn interfaces, choose SVNKIT(pure java) instead of the default JavaHL (JNI).
Thank you all.
Posted by: Mingyan | May 31, 2007 11:02 PM
martin u r awesome.
thanx a lot man. i spent one whole day just trying to figure out the problem. Finally the problem was to use "\\" instead of "\". never mind thanx anyways
Posted by: abhishek gupta | July 3, 2007 10:02 AM
thank you, that helped me alot
Posted by: alp | September 18, 2007 09:07 PM
But there is no "Windows->Preferences->Team" in Eclipse.
So how the configuration shoudl happen?
Posted by: Teemu | September 28, 2007 10:17 AM
worked like a charm. thanks
Posted by: rich w | December 25, 2007 01:13 AM
I am using eclpse 3.3 and have installed
subversion
svnservice
tortoise svn
putty
Also I have private and public key..
I am unable to use svn+ssh protocol to checkout projects?
Does the public key expire ot something after 5-6 months because it has been 6 months since I checked out this project at the site and since then I have reinstalled my PC... Please help ...
Posted by: abhishek gupta | January 15, 2008 03:08 AM
worked awesome..thanks !!
Posted by: Anonymous | January 27, 2008 09:38 PM
I needed a few attempts, but it finally worked perfectly. Thanks.
Posted by: Javier | March 7, 2008 11:40 AM
Martin, thank you for your details on the SVN_SSH env variable - I was able to automate SVN via command-line ant with it.
/michael
Posted by: Michael O'Brien | March 11, 2008 09:00 PM
Yes just slect the pure java Interface from the Window->Configuration>Team>SVN and then select SVNKit Pure interface
Posted by: Vajahat | April 17, 2008 01:43 PM
Wonderful! It actually works!
Posted by: Selvan | April 25, 2008 01:30 PM
THANK GOD!
Posted by: mike | May 1, 2008 10:57 AM
You are a genius!
Thanks so much!
Posted by: Anurat Chapanond | May 1, 2008 11:20 AM
Thank you VERY much!!!! It works!
Posted by: rma | June 1, 2008 09:15 PM
You are a darling my friend. You solved my pain.
thanks a ton
Posted by: Biren | June 26, 2008 12:34 AM