Local Subversion using svn:// gotcha – a life lesson in RTFM

I’ve set up Subversion on my Powerbook using the package provided by Martin Ott. One thing Martin’s packages don’t appear to include (I may have missed them somehow) is the Apache modules for Subversion, so connection to your local repository via http://, which is the most common method, is a no-go. I’ve always used http://, so I’ve never encountered the following issue in the past.
Essentially, this leaves you with either the file:// or svn:// protocols to play with. I’m using Eclipse as my IDE, and the Subclipse plugin to talk with the repository. As Subclipse apparently doesn’t play nice with file://, producing errors and failing to connect, you’re left with svn:// as your only option. That said, it’s a perfectly viable option.
I’ve put myself through a couple of nights of pain as I’ve tried to figure out why, when I start the Subversion server using svnserve -d -r /usr/local/svn/blog I could check out, but couldn’t commit. Eclipse was particularly unhelpful in producing virtually no error messages.

Here’s where the lesson in RTFM begins…

I’ve spent the best part of ten hours over two nights trying to determine why I couldn’t commit to the local repository. Google never really helped, no matter what I tried. Neither Eclipse, or trying to commit from Terminal helped either. Error messages weren’t especially useful.
Finally last night, I discarded all my built up geekosterone and turned to The Book. What do you know, there was the answer, right there in Chapter 6. Here’s what it boils down to:

  • the svn:// protocol provides read-only access by default
  • in order to use svn:// and be able to commit, you need to establish appropriate credentials to the repository
  • there is a simple and fast way to do this

First, you need to edit the repository’s conf/svnserve.conf file, so that it looks something like this:

password-db = passwd # this is the default name of the file, in the same directory as svnserve.conf
realm = Superduper Repository

# anonymous users can only read the repository
anon-access = read

# authenticated users can both read and write
auth-access = write

The settings for anon-access and auth-access actually have the above settings by default, so they don’t necessarily need to be there.

Second, you need to add user and password information to the password-db file, which by default is named passwd and is in the same directory as svnserve.conf. So, your passwd will look something like this:

trib = somepassword
alli = anotherpassword

Be aware that usernames and passwords in passwd are plaintext and not encrypted, so it’s a far from ideal solution in an open production environment. In that situation, set up a proper Subversion server with http:// or svn+ssh:// access.

After doing this, I had full access to the repository straight away and commited my changes, and could have had another few hours sleep this week.

Here endeth the lesson.

One Reply to “Local Subversion using svn:// gotcha – a life lesson in RTFM”

Leave a Reply