Using MediaTemple's Subversion (SVN+SSH) with Eclipse

Update #1: I normally add ‘Updates’ at the bottom, but this one simplifies this entire post. Daniel Spiewak was kind enough to point out that simply using the preferred Eclipse Subversion plugin “Subversive” works right out of the box, without any of this monkey-business. I have not confirmed this yet though, but I’d say it’s worth a try before doing all the stuff below.

Subversion Logo

NOTE: I am using Eclipse 3.2.2 + Subclipse 1.0.5 on Windows XP

So it’s pretty slick that MediaTemple lets you setup Subversion repositories on your (gs) accounts. I did that and followed this document from their Knowledge base to get the repository created. I stopped after this command:

svnadmin create –fs-type fsfs <repo-name>

Because the rest of the work, to create the project dirs, I can do from Eclipse once it’s working.

The problem now is that every time you try and connect to your repository, using a connection string that looks like this:

svn+ssh://serveradmin%25<customerdomain.com>@<customerdomain.com> /home/<site_number>/data/<repo-name>

NOTE: There is a space in the URL above right after <customerdomain.com>, this is intentional to allow the line to wrap so you can read the entire URL. You should not actually include the space in the URL you construct in your subversion client.

NOTE: In the comments at the bottom of the KB page, some user mentions using @ instead of %25 for another SVN client, in Eclipse, you need to use %25.

NOTE: You might notice, while SSH’ed into your MT account, that the actual path to your repository is more along the lines of /home/<site_number>/users/.home/data/<repo-name>. That’s ok, go ahead and use the path above and it still works.

Now, in order to get the actual connection working and have it stop failing in Eclipse, you need to check out this blog entry. It discusses how to setup a proper tunnel for SVN over SSH, which is what Eclipse keeps complaining about.

The trick is to load up your file C:\Documents and Settings\[user_name]\Application Data\Subversion\config in a text editor, go down to the line that looks like:

# ssh = $SVN_SSH ssh

And change it to something like this:

ssh = C:/Program Files/TortoiseSVN/bin/TortoisePlink.exe

NOTE: Using back-slashes instead of front-slashes won’t work on Windows.

You’ll notice I have TortoiseSVN installed, so I’m using the TortoisePlink executable. That might be the easiest thing to do, otherwise if you know what you are doing, feel free to specify something else.
Now that you have that setup, notice that if you attempt your connection in Eclipse again, it will work this time, but prompt you constantly for your password.

So now before we go freaking nuts, check out this article, it tells us how to setup password files for SSH so it stops prompting us. The key seems to be going to the PuTTY Homepage, and downloading PuTTYGen.

After you download PuTTYGen, run it. Tell it to generate a key and move the mouse around to add randomness to the key:

PuTTY Gen

When you are done generating the key, save Private key to a file, then move it someplace safe on your hard drive. Also you can copy the Public key to the clipboard as you will need it later.

Now go back to the blog entry we were reading earlier, and take note of the command:

ssh = [path_to_ssh_client] -2 -i [path_to_private_key_file]

So given that we are using TortoiseSVN already, our version of this string will look like this:

ssh = C:/Program Files/TortoiseSVN/bin/TortoisePlink.exe -2 -i C:/ssh_private_key.ppk

Before we are done, we now need to login to the site using SSH that we want to connect to, and do the following:

  1. $ mkdir ~/.ssh
  2. $ cd ~/.ssh/
  3. $ touch authorized_keys
  4. Open the authorized_keys file you just created in a text editor.
  5. Paste the contents of the public key PuTTYGen created for you into the authorized_keys file.

The content you want to paste in Step #5 is from the window in PuTTYGen that tells you to:

Copy Public SSH to Authorized Keys

NOTE: In the image above, the key is truncated for security reasons, yours will be much longer.

Now when you save that file and try and access the Subversion repository on MediaTemple, you won’t be prompted for a password and it will just work.

And that’s it… all 77 steps of this simple walk through :D

Tags: , ,

About Riyad Kalla

Software development, video games, writing, reading and anything shiny. I ultimately just want to provide a resource that helps people and if I can't do that, then at least make them laugh.

, ,

26 Responses to “Using MediaTemple's Subversion (SVN+SSH) with Eclipse”

  1. Daniel Spiewak May 15, 2007 at 9:48 am #

    Or you could just use Subversive and it all works perfectly out of the box. :-)

  2. Riyad Kalla May 15, 2007 at 9:52 am #

    Good lord, are you serious?

    I had in the back of my mind “I should try this with Subversive after I’m done” but never got around to it.

    That’ll learn me!

    Daniel thanks for the heads up buddy, I’ll add it to the post ASAP for others… except at the top so they see that first ;)

  3. Daniel May 24, 2007 at 10:11 pm #

    I tried Daniel’s idea, and it didn’t work. I keep getting a “illegal hex character ‘a’ after %” sort of error. Subversive doesn’t like the % in the name.

  4. Riyad Kalla May 25, 2007 at 7:01 am #

    Daniel,
    Does it work if you change it back to @?

  5. Daniel May 29, 2007 at 8:57 am #

    Riyad, nope. Both svn+ssh://user@domain.com/path/to/repo and svn+ssh://user@domain.com@domain.com/path/to/repo do not work.

    I’m going to throw myself off a cliff now.

  6. Daniel Spiewak May 29, 2007 at 9:05 am #

    @Daniel

    Very odd, we should probably file a bug with Subversive, try to get them to fix it.

    To their credit, this is a really strange SSH username formatting and I don’t really blame them for not supporting it (yet).

  7. Riyad Kalla May 29, 2007 at 9:11 am #

    Daniel,
    Try using Subclipse in the mean time until Subversive gets it’s svn+ssh support fixed up.

    I tried checking Eclipse’s bug tracker to see if it was a known bug and didn’t find anything… although I’m not sure if subversive is officially an Eclipse project or if it’s still in incubator.

  8. Daniel June 25, 2007 at 8:55 am #

    I tried Subclipse too with no success. I probably didn’t set something up correctly, so I’ll revisit that software sometime in the future. The hunt continues!

  9. Greg October 12, 2007 at 12:15 pm #

    How about witting up instructions for using the subversive plug-in. I could not get it up and running either.

  10. Riyad Kalla October 12, 2007 at 12:18 pm #

    Greg,
    I don’t use Subversive so I’m not sure how to get it working, but I use Subclipse regularly with it and it works fine with the instructions above (as long as they are)

    Which part were you getting stuck on?

  11. Marijn October 15, 2007 at 7:02 pm #

    Subversive hasn’t given me anything but trouble until now. Currently I am getting a no class def error for repository location validation. Google does not have an answer yet… Anybody here with that same problem? Would be really glad to find an answer since I kind of dislike subclipse…

    Thanks Marijn

  12. Riyad Kalla October 15, 2007 at 8:16 pm #

    Marijn,
    They are both surprisingly crappy…

    What are you doing when you get the NoClassDef error? Or do you get it and the plugin won’t even load?

  13. Marijn October 16, 2007 at 8:29 am #

    The plug-in will load but when I try to connect to my repo it pops up a send-error-feedback screen saying some class definition was not found for validating the repository location…

    I really love Eclipse as an editor but getting stuff to just work, especially “out of the box”, is just terrible. The whole software-update/managing should really get a lot more attention.

    If you would like more info let me know.

    Marijn

  14. Marijn October 16, 2007 at 8:40 am #

    The exact error:

    Subversive: ’0×00400006: Validate Repository Location’ operation finished with error: java.lang.NoClassDefFoundError

  15. Riyad Kalla October 16, 2007 at 8:46 am #

    Marijn,
    The Eclipse Update Mechanism has been one of the most-complained about designs and features of the Eclipse platform since it’s inception.

    Software vendors that build products ontop of the platform (forget the users) find the mechanism almost completely unusable in some pretty normal update cases. Unfortunately the group working on that aspect of Eclipse think it’s just fine which is why it hasn’t fundamentally changed it’s design since Eclipse 2 I think.

    As far as that error goes, if you are able to see it *that* quickly by simply trying to connect to a Repo, I guess you can’t be alone… have you tried searching the Subversive group?

    Unfortunately I don’t use Subversive so my ability to help with it is diminished.

    You might also make sure (Help > Software Updates > Manage Config) that the Subversive plugin is installed correctly and isn’t missing some plugin dependency or something. You will also want to make sure you installed a version of Subversive that is compatible with your release of Eclipse.

  16. Marijn October 17, 2007 at 3:25 am #

    Well, last night I figured to go for a complete re-install of Eclipse. Downloaded the same packages (for all I know at least) but somehow it works now:D

  17. Riyad Kalla October 17, 2007 at 4:39 am #

    Doh… well I’m glad it’s working. I hope it doesn’t break again. If it does you can try troubleshooting using some of the tips I mentioned, it might help get things narrowed down.

    Eclipse can become a crowded/confused place and does not avoid the “DLL Hell” phenomenon that any large complex system suffers from unfortunately :(

  18. Alexei Goncharov November 30, 2007 at 10:18 am #

    The described problem was reviewed and probably a fix for it was found. It would be available in the next version of Eclipse Subversive.

    To access the repository you should specify only % in username, not %25.

    Best regards, Alexei Goncharov (Subversive team).

    https://bugs.eclipse.org/bugs/show_bug.cgi?id=211418 – bug description.

  19. Riyad Kalla November 30, 2007 at 10:25 am #

    Alexei,
    Thanks for the heads up, we appreciate you keeping us posted on the issue.

  20. Tomek November 8, 2008 at 5:45 am #

    one important note: when copying/pasting public key to the file be sure to get rid of any new lines – I used nano (over ssh) to edit “authorized_keys” and I when pasted public key copied directly from PuTTyGen there were three lines of text (probably something with new line symbol differences between Windows and Unix – in Notepad there was only one line) and when I left it like that I couldn’t connect to repository

  21. valugi April 18, 2009 at 10:20 am #

    Thanks. The MT kb article is pretty incomplete and this was pretty helpful.

Trackbacks/Pingbacks

  1. The “Break it Down” Blog » Blog Archive » Finding a Good Hosting Company - May 27, 2007

    [...] of view. For example, out of the box I have Subversion installed on the account and was able to quickly set it up and use it with Eclipse for [...]

  2. » links for 2009-01-28 Thej Live - January 28, 2009

    [...] Using MediaTemple’s Subversion (SVN+SSH) with Eclipse | The "Break it Down" Blog Using MediaTemple’s Subversion (SVN+SSH) with Eclipse (tags: subversion eclipse mediatemple) [...]

  3. bladamir » Blog Archive » SVN + MediaTemple - June 2, 2009

    [...] http://www.thebuzzmedia.com/using-mediatemples-subversion-svnssh-with-eclipse/ [...]

  4. Subversion on Media Temple « Routy Design - July 11, 2009

    [...] http://kb.mediatemple.net/questions/143/Using+Subversion http://www.thebuzzmedia.com/using-mediatemples-subversion-svnssh-with-eclipse/ http://mitchellhashimoto.com/subversion-on-mediatemple/ http://stackoverflow.com/questions/438348/pushing-from-subversion-to-web-server [...]

Leave a Reply


9 + 9 =