Connecting with Eclipse to a remote SVN repository via SSH on non-standard ports

Having been bitten by this for the n-th time (with n being subjectively a large integer), I’m noting this down for the following generations to benefit; and hopefully to save myself some fiddling next time it happens. Without further ado:

How to connect with SVN to a remote repository that is running on a non-standard SSH port

 

The problem

Normally you’d expect that entering something like “svn+ssh://myserver:port/path” as an SVN repository location in Eclipse should be enough. Unfortunately this won’t take us anywhere – either it won’t be able to connect to the server or the supplied credentials will fail.

The reason is that the default subversive SVN connector SVNKit doesn’t pick up the necessary settings and JavaHL reads SSH configuration which needs to be updated.

 

The solution – short

You’ll have to use the JavaHL connector, setup an ssh alias including the non-standart port and also use a keyfile for login; user/pwd won’t do it.

 

The solution – long

1. Switch subversive to JavaHL: Window -> Preferences ->SVN Connector -> Native JavaHL.

If the option is missing, you are either not using the subversive plugin (so get it maybe?) or you have not installed the JavaHL plugin (you also need to do that).

If JavaHL is available but disabled with an error about missing libraries, then install them in linux:

apt-get install libsvn-java

For more see [1] Installing JavaHL. In my installation Eclipse would still not pick up JavaHL, I needed an alternative installation:

apt-add-repository ppa:dominik-stadler/subversion-1.7

apt-get update

apt-get dist-upgrade

2. Set up an alias in ~./ssh/config

Host example_alias
    HostName your.example.ssh.server
    Port 12345
    User ssh_user

performing obvious substitutions

3. Create a local keyfile and upload it to the ssh server to enable login without password. For details see [2] Login to ssh without a password

[update 2013.01.09]
Note that you will probably run into problems with ssh-copy-id with the port notation [3]. Use:

ssh-copy-id "user@host -p port"

Resources

[1] Installing JavaHL
http://islandlinux.org/howto/installing-javahl-subclipseeclipse-ubuntu
http://stackoverflow.com/questions/8434449/how-to-upgrade-javahl-on-ubuntu

[2] Login to ssh without a password
http://askubuntu.com/questions/46930/how-can-i-set-up-password-less-ssh-login

[3] Use ssh-copy-id on a different port
http://it-ride.blogspot.com/2009/11/use-ssh-copy-id-on-different-port.html

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.