Multiple repositories and subversion

Last time we looked at multiple projects which was a nice way of serving more than one project from the same repository.

But what if we wanted our projects to be completely separated? Well, serving multiple repositories is the answer.

There seems to be a bit of a rumour that this is a difficult route to go. Nothing could be further from the truth. Multiple repositories are incredibly easy to set up and to serve and do solve issues related to version numbering and so on.

clean up

Let's start with a clean slate: If you have been following the previous articles, you may well have project1 and project2 in the 'work' and 'repository' folders on your Slice.

Let's delete the old stuff:

cd ~
rm -rf /home/demo/repository
rm -rf /home/demo/work/*

Now we have a clean sheet to work from.

create the repositories

Start by creating a folder to hold our repositories and then, using svnadmin, create two new repositories:

mkdir repositories
svnadmin create repositories/repo1
svnadmin create repositories/repo2

create projects

Next, I'm going to create two incredibly simple projects and import them into the separate subversion repositories:

mkdir project1
touch project1/project1.txt
svn import /home/demo/project1 file:///home/demo/repositories/repo1/project1/trunk -m "import project1"
mkdir project2
touch project2/project2.txt
svn import /home/demo/project2 file:///home/demo/repositories/repo2/project2/trunk -m "import project2"

Notice that this time, for each initial import subversion reported:

Committed revision 1

Now the two projects are separated. Had we used the technique described in the multiple projects article, project2 would have been committed as revision 2.

delete originals

Delete the original project folders as we don't need them any more:

rm -rf project*


We could simply check out the projects on the same machine but that's not much fun. Let's setup svnserve to serve both repositories at the same time.

This is exactly the same as when serving one repository:

svnserve -d -r /home/demo/repositories/

That's it. It is incredibly simple to set up. Naturally, if you have a firewall, ensure you allow connections to port 3690. If you are not sure how to go about that, details can be found in the introduction to svnserve article.


As we have created two different repositories (repo1 and repo2) we can now set different permissions for each one.

So to configure permissions for repo1, edit the following file:

nano /home/demo/repositories/repo1/conf/svnserve.conf

Set up your permissions as outlined in the introduction to svnserve.

Then simply follow the same procedure for repo2.


Checking out the different projects uses the same procedure as before. So from your local workstation, issue the command(s):

svn co svn://
svn co svn://

Add, edit and delete files as you would for any other project under subversion control. Any commits you make will be for that project only.

permissions demo

To demonstrate different permissions with one instance of svnserve running, I set the permissions in repo1/conf/svnserve.conf to this:

anon-access = read
auth-access = write

and for repo2 I set them to this:

anon-access = none
auth-access = none

As you may imagine, when I tried to check out project1 (from repo1) I had no issues, but when I tried to check out project2 (from repo2) I was denied access:

That's exactly what I wanted. Nice.


Don't forget you can secure the connection using SSH as outlined in the previous article


Article Comments:

Ron Vander Wal commented Mon May 11 21:46:07 UTC 2009:

great tutorial. clean and simple answer on how to host multiple repositories on one server with svnserve.

Gabriele commented Wed Sep 16 10:12:01 UTC 2009:

Sorry but svnserve on the parent folder of the two repos is not working. TortoiseSVN is not seeing any repo. What could be wrong?

San Vad commented Tue Oct 13 01:10:15 UTC 2009:

Multiple repositories are not working for me too. Neither TortiseSVN nor SVN list is showing the repositories. I could only able to start the svnserve for one repository. If I give parent directory of the repository in SVNSERVE command, it doesn't start. Please help.

Dave commented Fri Feb 12 09:43:02 UTC 2010:

This will mix up the build numbers and have only one build for all includes repos.

ante commented Tue May 11 12:09:26 UTC 2010:

it works with tortoise with path like this svn://host_name/repo1 and svn://host_name/repo2

Want to comment?

(not made public)


(use plain text or Markdown syntax)