Creating subversion repositories for just about anything

I’ve been using Subversion for just about everything I work on including keeping my documents synchronized across multiple computers, backups, source control, etc… I got the idea a while back from Martin Fowler’s Bliki who uses it for a similar purpose. All you need to host your own Subversion repository is a shell account on a machine that you can SSH into. Sure, you could create a repository on your local machine but one of the goals is to have it on another machine in case your hard drive bites it.

I’ve gotten in the habit of creating a new repository at the drop of a hat for anything I might want to backup/version. However, after a little trial and error I’ve learned to avoid the Berkeley DB format for the repository which seems to have a tendency to get corrupted. The default nowadays is the highly stable fsfs repository type so you don’t need to worry about it, but I think it’s good to be aware of the issues with the bdb fs-type so you know to avoid it.

Here are the steps I use to create a new repository:

# Create the repository
mkdir svn
svnadmin create --fs-type fsfs svn/mydocuments
# Import some files into it from another machine
cd mydocuments
svn import . svn+ssh:// -m "initial import"
cd ..
mv mydocuments mydocuments.bak
svn checkout svn+ssh://
cd mydocuments
# Edit somefile
svn commit somefile

Once you’ve done this for a bit you’ll likely get tired of typing in your password for SSH all of the time and will want to look at using SSH keys.

This entry was posted in Source Control, Systems Administration. Bookmark the permalink.