Setting up SVN with MediaTemple Grid Server and Subclipse

I’ve helped a couple people with this already, and I keep forgetting some of the details myself, so I thought I’d write it down so it’s here when I need it, and anyone else can benefit from it too.

One of the neat things about having a MediaTemple Grid Server account is that it comes with an SVN server. Since you get something like 100 GB storage with your account, it makes sense to host your source control there, not on the same machine you are developing on, or another machine sitting right beside it. I guess what I’m saying is if your house burns down, at least you won’t lose your source. 🙂

One of the tough things about the MT implementation of SVN though, is that it uses the svn+ssh protocol. Actually, I suppose there are some security benefits there, but it can make it a bit more confusing to set up.

So, there are two steps to setting up SVN with MT and Subclipse. First of course is creating your repository on the server. This you have to do by hand. You’ll need some way to ssh into your server. Putty is the tool of choice (free) on Windows. On OS X just fire up the terminal and type ssh.

Once you’re in there, just follow this article:

http://kb.mediatemple.net/article.php?id=143

Actually, just follow the first three steps of that article to set up the repository itself. Don’t go making directory structures and importing them. You’ll do that via Subclipse.

The next step is connecting to your repository in Eclipse via Subclipse. First, of course, install Subclipse. This page walks you through how to do that: http://subclipse.tigris.org/install.html. Follow the whole thing, step by step. When you are done, you should have the SVN Repository View open.

There’s a very important step here that took me forever to work out, but is really very simple. Go to Eclipse’s preferences, and go down to Team/SVN. You’ll see a section there called “SVN Interface”, with a couple of radio buttons. Probably, the “JavaHL (JNI)” checkbox is checked. You don’t want that. Instead, check the other one, “SVNKit (Pure Java)”. Click ok to close prefs. I have no clue what this is all about, but if you don’t do this step, you won’t be able to connect. So do it. This seems to hold true for both Windows and Mac.

Next step is to connect to your repository. Click on the “Add SVN Repository” button in the SVN Repository View. This opens a dialog where you enter the url to your repository. COMPLETELY IGNORE the steps from the MT article on how to set the url. It will not work like that in Subclipse. Instead, enter your repository path like so:

svn+ssh://mydomain.com/home/xxxx/data/reposname

Where mydomain.com is of course your domain name, xxxx is your MT account number, and reposname is whatever you named the repository when your created it. Do NOT try to stick your username/password in the url like it says in the MT article. Also, your MT Account id may include a letter, like “s1234”. The account NUMBER does not include that letter. It would just be “1234” in that example. After that, press finish. This should prompt you to enter your user name and password. You shouldn’t need to escape the @ symbol here. Just type it in. It’s usually something like serveradmin@mydomain.com. Password is whatever it is. You can check the checkbox to save this information, so you don’t have to enter it each time. I think it also asks you to type your name so it knows who is checking things in and out.

When you are done with that, if all goes well, you should connect to your repository and it will show up in the view. If not, you’ll get an error message saying what went wrong. Assuming you got it going, we’ll move on.

Now you need to set up a folder for your first project. Right click on the repository in the list and choose new folder. Name the folder whatever the project name is, i.e. myproject. You can now right click on myproject and add a tags and branches folder as well, if that’s how you set up your repositories. Do not add a trunk folder yet!

Now you are ready to import your first project. Assuming you have a project open in Eclipse, right click on the project, or whatever portion of it you want to check in. Go down to Team, and choose “Share project.” Choose SVN, and the repository you just connected to. Now it will ask you to choose a folder to check into. It defaults to using the actual Eclipse project name. But you should choose to use a specified folder name, and then browse to the project folder you just created. Now it’s going to tell you can’t use an existing folder, so will tack on “New Folder” to the path. Change that to “trunk”. Now you see why you didn’t create the trunk folder before. If you’ve done everything right, the url shown in the dialog should be something like:

svn+ssh://mydomain.com/home/xxxx/data/myrepos/myproject/trunk

You are good to go. Hit finish and it should create the folder and look through your project and present you with a list of things it things it should check in. It will skip the bin directory, but will probably include everything else in the project. It’s up to you how much you want to include. If you accept the defaults, you can then check the project out on another machine as a full blown Eclipse project, ready to run, which is kind of cool. But you might just want to check in the source folder. Again, up to your way of working. Hit OK, and it will check everything in. You are done.

Now you’ll notice that all your checked in files will have little icons on them in the Navigator. A yellow thing means it’s checked in. A gray star means it’s changed locally. There is no indication that the file has changed in the repository, so if you have more than one person working on a project, or you work on it from multiple locations, you might want to do an update before you start working each day. New files are marked with a question mark. When you’ve done some work and want to check in, right click the project and go to Team / Commit. This will present you with a list of changed files and new files. You can choose which ones to commit.

That’s all there is. The rest is just straight version control. I highly recommend the book, Pragmatic Version Control with SVN, to learn more about it if you are new.

Oh, one other thing I should mention. When you go to check out a project, don’t make the mistake I did a couple of times, of clicking on the project itself in the repository view and choosing checkout. This will check out the whole thing, trunk, tags, branches, whatever else you’ve got in there. You usually want to open the folder and right click on trunk, and check that out.

This entry was posted in Flash. Bookmark the permalink.

17 Responses to Setting up SVN with MediaTemple Grid Server and Subclipse

  1. Keith – great article. 2 things that might be helpful for others.
    1. I got stuck on the media temple account number – i added an “s” to the beginning of mine – which is how I connect via ftp. Dumb mistake.
    2. I use Tortoise instead of subclipse – if you use that you use the following url to connect
    assuming your domain is “test.com”
    and your site # is “1234”
    repos name is “myRepos”
    svn+ssh://serveradmin@test.com@test.com/home/1234/data/myRepos

  2. kp says:

    Thanks Doug. Good additional info.

  3. kp says:

    I updated the article to include the data about using the number only, not the leading letter.

  4. Brilliant stuff, thanks! Never figured it out using the (mt) KB article, this really helps!

  5. Hey Keith. Hope all is well. Sam Robbins sent me this, and it was a lifesaver. I just switched to MediaTemple and their tutorial of setting up directories and importing was throwing me way off course.

    The other thing that was confusing me (dumb mistake on my part) is that I hadn’t switched my domains over yet, so I needed to set up the svn URL like so: svn+ssh://s12345.gridserver.com/home/12345/data/reposname

    with 12345 being the site number. Just wanted to add to this article in case other people stumble with the same issue.

  6. I too was struggling with this for hours on Windows until I installed Subclipse and followed your guide. I could never get TortoiseSVN to reliably connect. I’ll be sharing this with the folks at (mt). Hopefully they can update their KB articles and pull out the errors.

  7. Nice going, this is exactly what I needed to make my local development webserver work as it should (though it took a few attempts since I didn’t actually read your article, just lazily scanned it 😉 )

  8. Having a small problem. Created the repository like the KB guide suggested, and then followed yours. I get to the connection part and it gives me an error that it’s looking in my repository for a format directory. I’m still rather new to svn, but as far as I know, I don’t have a format folder..

    Any thoughts or suggestions for this problem?

  9. Tim says:

    have you had any luck using svn:externals with svn+ssh through mediatemple?

  10. Sean says:

    any luck with installing websvn? I’m considering changing hosts and this is the one feature that’s keeping me from going to the mt gs.

    http://websvn.tigris.org/

    http://websvn.tigris.org/servlets/ProjectDocumentList
    Direct: http://websvn.tigris.org/files/documents/1380/39377/websvn-2.0.zip
    Direct: http://websvn.tigris.org/files/documents/1380/39378/websvn-2.0.tar.gz

  11. Josh says:

    For some reason I just cant get this to work it is annoying the hell out of me!! I can get it to work in terminal with the svn ls they show in the knowledgebase but I cant get it to work in neither Versions or Eclipse… I just dont know what I am doing wrong.
    I keep getting
    svn: Cannot connect to ‘svn+ssh://website.com’: There was a problem while connecting to website.com:22
    Any help

  12. Shaun says:

    Cheers Kieth, managed to get svn running on my mediatemple account… after hearing that it was a bit of a nightmare from one of the guys ay my office.

  13. melody says:

    This was a really great tutorial and super helpful. Thank You Very Much!

    However, following this verbatim, I was still unable to establish a connection from subclipse to the repository on my media temple grid server. (as a side note … I am on OSX) I found the info I needed in the subclipse FAQ: http://subclipse.tigris.org/wiki/PluginFAQ#head-214e1cef790ceb311232ec766435d62c7958ccb7

    By default Eclipse is set to JavaHL … in order to establish a working connection with my repository, I had to change the SVN Interface to SVNKit as follows: Goto Eclipse->Window->Preferences->Team->SVN and change the SVN Interface to SVNKit

  14. Andrew says:

    Nice article, thanks. Worked great.

  15. SVN and MediaTemple are a pain in the ass. I used to have the same problem then I moved to DreamHost. Much more easy.

Leave a Reply