I've been using subversion for all my versioning needs for a while now, but I've always either used existing repositories or set the repository up in a user account. I'd like to give other local users the ability to commit to some of the projects I'm working on, so I've been trying to set up a subversion repository in the directory root. After a number of false starts, I've got what I think is a sensible solution. I'll document the false starts and the solution here.

I created a group called svn, and I'll add anyone who I want to give commit access to that group. Subversion needs to create the repository directory, so I started off with
% svnadmin create /svn svnadmin: Repository creation failed svnadmin: Could not create top-level directory svnadmin: Can't create directory '/svn': Permission denied
Of course, I'm not logged in as root, so svnadmin doesn't have permission to create the directory. I always do this, because I'm a dill, which means I use the bang bang history substitution regularly.
% sudo !! svnadmin create /svn
This runs the last command with sudo, and successfully creates the repository.
% ls -dl /svn drwxr-xr-x 7 root wheel 512 Nov 15 14:13 /svn/
The repository and all the files and directories inside it are owned by user root in group wheel. That's not good, because I want normal users to be able to write to the repository. I could change all the ownership and permissions of files and directories using a couple of find commands but that feels wrong.

Then Donal reminded me that each project should have it's own repository. This is because when a commit is made the repository revision is incremented, rather than the committed files revision. So, what I should do is to create a top-level directory that will hold the repositories, then create a repository for each project inside that.

First, set up the directory that will hold the repositories, ensuring it has correct ownership and permissions.
% sudo mkdir /svn % sudo chgrp svn /svn % sudo chmod 775 /svn

Next, create a repository inside that directory. I'm working on my first theme for Habari, so I'll create a repository for that work.
% svnadmin create /svn/habari

There are a number of different ways to get your project into your repository. I prefer to check out revision 0 and add my work to it.
% svn checkout file:///svn/habari Checked out revision 0. % cd habari % cp -r /usr/local/www/habari/htdocs/user/themes/connections/habari/ . % svn add themes (output omitted) % svn commit (output omitted)

Now I have a shared repository that (hopefully, but untested) members of the svn group can checkout and commit to. Of course there's a better way, please let me know.