*

2006 / February 11th/ Setting up Subversion with Dreamhost and Windows

Subversion is an immensely useful tool, especially for the practicing web developer. Think of it as the backups you never created: after setting up your project in Subversion, you can go back to any point in your applications life and see what was changed between then and now. It’s also a great way to make backups of your data without much fuss at all. Just commit your changes, and instantly you have a copy of your data on a remote server.

Recently Dreamhost started offering Subversion on all of their plans. This is great news, and the reason I decided to set up an account with them (I’ll slowly be moving all of my sites as I get time). So, for those with Dreamhost accounts, or anybody thinking about getting an account–here’s a quick guide to setting up your projects with Subversion on Windows(XP) and Dreamhost. While this article is long, it should only take less than a half hour to get up and running with Subversion.

A brief introduction to Subversion

Subversion is a source-control system that tracks changes to your files by recording the differences (diffs) between files. It’s a method to save copies of a particular file (or set of files) in a project at a point in time. Think of it as a giant undo button that lets you go all the way back to when you started your project. Subversion works in two parts: the client, and the server.

Setting up the Client

The first step should be to get your Subversion client all set up. I can’t recommend Tortoisesvn enough. There’s no command line trickery, no complicated config files. Just right click, commit, delete, or export. Setting it up is dead simple: Download, install, restart your machine and you’re up and running.

Screenshot

Making sure it’s running.

It’s a good idea to make sure all of your settings are running alright and Tortoisesvn can talk to the internet. Go into any folder in your file system, and right click. There should be a new sub-menu called “Tortoise SVN.” Go into that menu, and click on Repo-Browser. When prompted for the URL of the repository, type in a known repository, like: http://dev.rubyonrails.org/svn/rails. Click on the plus sign to the left of the folder in the window that pops up, and you should see a list of sub-folders. If you’ve gotten this far, you’re ready to move on to the next step!

Setting up the Server

The next step is also dead simple, thanks to Dreamhost. Log into your control panel and click on the “Goodies” section in the left-hand navigation. From this menu, you can choose Subversion which will take you to a page to create a new repository. Repositories are places to store projects; so it’s probably a good idea to make a new repository for each of your projects.

To create a new repository, fill in the fields. Create a name for the project, and a unique id (for example: warpspire). After you click Create, you might have to wait a couple of minutes for the little robot to create your repository for you. Go drink some coffee and come back in a few minutes.

Screenshot

Setting up a project

This one eluded me for quite some time without some trickery, but when it came down to it, it was super-easy to. First, create the files for your projects as you usually would. After you’ve come to a point where you want to put it into a repository, right click on the folder. Navigate to TortoiseSVN and click on the Checkout button. This will generate a warning saying the folder is not empty, don’t worry–this isn’t going to modify any files as long as your repository is empty. You have just made this directory your working directory — keep that term handy, it’s used in a lot of Subversion documentation. A working directory is a directory that you keep all your files in, and that Subversion keeps track of (through hidden files).

Screenshot

Adding your files

Now that you have a working directory, it’s time to add all your files. Right click on the directory again, and click the new Commit menu item. A dialog will open up with a list of files. TortoiseSVN is telling you which files it’s going to add to the repository (or which ones it will change). At this point, it’s a good idea to check them all and click okay. That’s it, you’re rolling on Subversion!

Keeping up with Subversion

Now that you have your project all set up in Subversion, you can start using it as you work. Here comes the good news: you don’t have to do anything different for Subversion to work. Just edit the same files as before. Subversion will keep track of the changes, and let you know (through icons on folders and files) when they’ve been changed. However, there are a few basic actions you must learn, but don’t worry: they’re really easy.

Committing changes

As you work, Subversion will keep track of changes to the file. In order to save these changes to the repository, you must commit your changes every now and then. I suggest every major bug fix, landmark, or day that you work. To commit changes, simply commit them as you did when you were adding files the first time. You can commit specific files at a time, or files project-wide.

Keeping track of changes

Another tool to play with is the Diff tool, which keeps track of what changed in each file. Anytime you want to see the difference in versions, or say the differences in the file you’re working with versus the last copy saved in the repository, right click and go to TortoiseSVN->Diff It will bring up a window like the one below, showing you what file was changed, and how it was changed.

Screenshot

Exporting

When you create a working directory, Subversion automatically creates a series of hidden files in .svn folders. Whenever you update your site, you probably don’t want to keep these files on your remote server. This is when the Export command comes in handy, as it lets you export a site without all the .svn files. To do this, just create a new folder somewhere (say on your desktop) and then right click, TortoiseSVN->Export and then type in the URL of your repository. After you click okay, Subversion will create a copy of your project without the hidden folders.

For an added bonus, try playing around with the command line client. You might just end up getting rid of your FTP program all together. Try typing in svn export http://url/to/your/repository in a directory on your web server. Now you can update your site with one little command!

Enjoy source-control

That’s all you need to start enjoying the benefits of source control! Also, designers remember: source control isn’t just for code. It’s great for PSDs as well.

26 Comments

comments feed

  1. Gravatar
    Jeff Smith

    February 11th | #

    Today I finally got around to getting myself set up with SVN on Dreamhost. I had a subversion server running here on my home network, but this is much more convenient as I know have access to it everywhere.

    For those that might be interested, Chris J. Davis wrote up an article a while ago about getting svn up and running on OSX.

  2. Gravatar
    matt

    February 14th | #

    Nice setup guide, Kyle. It is a lot easier (and more powerful) to set-up SVN using the new web-admin. I set mine up manually, and had all kinds of ssh+svn authentication hassles and had to install Putty and all that. And it was single user access. Doh.

    One tip, when you’re starting a new project, just use the TortoiseSVN command “Import” to import your new project. It’s under “Tortoise SVN… | Import…”

  3. Gravatar
    Kyle

    February 14th | #

    One tip, when you?re starting a new project, just use the TortoiseSVN command ?Import? to import your new project. It?s under ?Tortoise SVN? | Import??

    Actually matt, I omitted that for the checkout/commit scheme because of this: When you import a project, it doesn’t turn your directory into a working directory. It just imports it, meaning you have to create a new directory for your working directory.

    But yes, I must aknowledge that the web interface is really nice. I had all kinds of crazy getting my repositories up and going on TextDrive because of the manual apsect of it. Dreamhost made it easy on me :)

  4. Gravatar
    Veracon

    February 15th | #

    I didn’t even know there were GUI tools for this, haha. Then again, I don’t think I could live without my beloved bash, so I guess these tools aren’t for me.

    But yeah, Subversion is really nice (and, Site5 has been offering it for “ages” ;P).

  5. Gravatar
    Scott Mackenzie

    March 6th | #

    Just wanted to say I used this guide to get svn up and running on Dreamhost and it worked fine. Thanks indeed!

  6. [...] Kyle Neath has just written an excellent quick guide about Setting up Subversion with DreamHost and Windows. He jumps straight to the point and shows how to set up a repository at DreamHost and how to manage it with TortoiseSVN. Great introduction to everybody new to Subversion. [...]

  7. Gravatar
    Tom

    March 28th | #

    Great little tutorial Kyle. You saved me lots of time and have made my life much easier point out Dreamhosters. I went and got myself an account and set it up without a hitch using your instructions.

    Many Thanks!

  8. Gravatar
    John

    March 30th | #

    Wow, that’s cool. I just spent a good part of two days setting up Subversion on a windows box at home. Still can’t view it via https. None of that hassle this way. I might have to move all of my projects to a repo on Dreamhost =)

  9. [...] ????google, ??????:Setting up Subversion with Dreamhost and Windows, ????????????checkout?????????????????????????????????????????????   [...]

  10. Gravatar
    Harold

    April 7th | #

    I also set up Subversion on Dreamhost, using the one-click installs. What I’d really like to install is Trac (http://www.edgewall.com/trac/), a very slick svn interface with wiki and bugtracking. However, one of the pre-requisites (Clearsilver) is not supported by Dreamhost. Does anyone know of any alternatives to Trac that might be worth trying?

    Alternatively, how about everyone starts hassling Dreamhost to add Clearsilver support?

  11. [...] http://warpspire.com/journal/web-production/setting-up-subversion-with-dreamhost-and-windows/ [...]

  12. Gravatar
    David Bond

    November 7th | #

    Hey – great tip about the new project. Worked as you described, though it would be nice to add some handholding to the first Checkout step. For example, describing how/whether to set up the repository first. Should it be on localhost etc.

    Cheers :o)

    David

  13. Gravatar
    Dave Cassidy

    November 20 | #

    Excellent tutorial…

    Also, for thos eof us that are switching from CVS to SVN and are awfully fond of our $Id$ strings, you should right-click on the file, choose properties and add the following property:

    Property:
    svn:keywords

    Value:
    Id

    Click okay and commit your changes. Don’t forget to update the file from the Subversion repository, and you should be able to see the new string in place.

  14. [...] Here’s an excellent article I found on Setting up Subversion with Dreamhost and TortoiseSVN.  [...]

  15. Gravatar
    shao

    February 8th | #

    Let me ask for forgiveness for being so naive, in advance, is DreamHost is the only way, cant I do the same thing on some other free web space site for eg ?

  16. Gravatar
    Jeff

    February 15th | #

    Very helpful, thanks.

  17. Gravatar
    Programmer

    August 15th | #

    Coming from a vb.net background, I’m a little confused with the vocabulary (Get latest version = Update), but it seems to be working fine for me right now, thanks!

  18. Gravatar
    Ted

    October 5th | #

    Weird. Neither you nor the Dreamhost people mention how to figure out what URL to type into Tortoise to get connected. And yet people in the comments seem to have made it work without that information. It’s mystifying to me. I’ve tried all the variations I can think of on the URL that shows up on my Subversion setup screen on the Dreamhost site, and I keep getting the good old
    Error: PROPFIND request failed on ‘/’
    Error: PROPFIND of ‘/’: 200 OK (http://www.tedtedted.com)
    I think I’ve got the wrong URL, but how to figure out the right one is beyond me.

  19. Gravatar
    Kyle

    October 5th | #

    Hey Ted,

    If you go to the Goodies -> Subversion item in the DH control panel, the first field is “Project URL” when listing your repositories. That’s the URL you should use. Good luck!

  20. Gravatar
    Ted

    October 5th | #

    OK, my bad. It was a dreamhost-specific issue: sites more than a year or so old are reported to have problems, for httpd-related reasons that are over my head.. I started a new subdomain and set up a Subversion repo there, and it worked great. Thanks, Kyle. Great work.

  21. Gravatar
    Pierre

    December 26th | #

    Ted, I did not understand you? Why is it so important that these pages are old almost one year?
    Please explain?

  22. Gravatar
    Leo

    May 13th | #

    Thanks! I’ve been trying to work out how to get it working, and your guide was extremely easy to use, and I got it working! Thanks so much!

  23. [...] Setting up Subversion with Dreamhost and Windows – Warpspire (tags: svn subversion dreamhost setup warpspire) [...]

  24. Gravatar
    Ian

    August 12th | #

    Hi,

    Thanks very much for the wonderful tutorial. Explains a lot of the concepts about Subversion and how it works in practise as well as a guide for installation.

    Many Thanks and keep up the good work!

  25. Gravatar
    Topher

    August 12th | #

    Thanks a lot. Having used svn with work I really wanted to add it for my personal site. You’re walk through made that quick and easy.

  26. Gravatar
    John

    February 10th | #

    Pierre: Its just that some of dreamhosts older server don’t have svn installed. They apparently have a system in place to move you to a new server if you want svn but sometimes it fails, they prefer instead you create an subdomain for svn which they will just move that subdomain.

Make a Comment

don’t be afraid, it’s just text

Comments are parsed with Markdown. Basic HTML is also allowed.