HowTo: Configure SVN+SSH with Subclipse on Windows

| 36 Comments

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:-

  1. 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.

  2. Download and installed the excellent TortoiseSVN client for Windows.

  3. 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)


  4. Configure the Subclipse plugin to use JavaHL (JNI)

  5. Restart Eclipse

  6. Do a little victory jig (optional)


36 Comments

Hi Martin

Just saw the post about your new job in Illinois - congrats.

Sam (from BT)

What the hell are you on about? :)

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.

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.

Sweet, thanks for the info. I had a similar problem with AnkhSVN and Visual Studio 2005, and the environment variable fixed it.

# 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

Nice! Thanks for the excellent instructions. I did the optional victory jig.

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).

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

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

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.

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.

Thanks for taking the time to post this. This fixed the Subclipse problem I was having.

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.

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

thank you, that helped me alot

But there is no "Windows->Preferences->Team" in Eclipse.

So how the configuration shoudl happen?

worked like a charm. thanks


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 ...

worked awesome..thanks !!

I needed a few attempts, but it finally worked perfectly. Thanks.

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

Yes just slect the pure java Interface from the Window->Configuration>Team>SVN and then select SVNKit Pure interface

Wonderful! It actually works!

THANK GOD!

You are a genius!

Thanks so much!

Thank you VERY much!!!! It works!

You are a darling my friend. You solved my pain.
thanks a ton

Thanks, this worked great for me! I was pulling my hair out!

-D

Thanks Martin. This solution worked for me.
I recently started seeing the 2 messages:
- "The system cannot find the file specified..."
- "Can't create tunnel..."
Which I had never seen before. And SVN was working fine.
I thought I had set it to use the pure Java drivers.
So, I checked and found that I only had one choice (JNI).
And, until I came across your fix. Subclipse would not work.
I even tried Revert-Reinstall.
-Dave

Thanks for that, it worked a treat first go!

To save your password set this in your Windows Env Variables:

Variable name: SVN_SSH
Variable value: C:\\Program Files\\TortoiseSVN\\bin\\TortoisePlink.exe -l username -pw password

;)

u rock man

i was dead when SVN was not working on my eclipse after i setup a 1.6 repo and basically svkit is not supporting the same (i was using it b4)

had to use javaHL and u made my day

plink rocks

i was annoyed to see popups with cygwin's ssh

Thankyou so much for this little tutorial!

Was bashing my head against the keyboard to this solved my problem.

All I had to do was Go to Window->Preferences->Team->SVN->SVN Interface and switch to SVNKit, then the problem fixed itself.

Thanks for the great post (that although wasn't quite the fix for me, it helped me find a solution that worked for me in the comments).

Archives

Creative Commons License
This blog is licensed under a Creative Commons License.