Blog Entry

Multiple svn repositories

You have multiple projects and you want each to be managed in its own svn repository. At the same time, you want them all served by the same server machine myserver.org: In the server myserver.org that will house the repositories, create the new repositories under the same directory:

$ pwd
/home/user
$ mkdir svn
$ svnadmin create svn/repo1
$ svnadmin create svn/repo2
Assuming we have two already existing projects project1 and project2 in our projects directory, we now import each of the projects into each of the repositories:
$ svn import /home/user/projects/project1 file:///home/user/svn/repo1/project1/trunk -m "import project1"
$ svn import /home/user/projects/project2 file:///home/user/svn/repo2/project2/trunk -m "import project2"
Now that our two projects are under subversion control, we can delete the original project files:
$ rm -rf projects/project1
$ rm -rf projects/project2
Finally, in order to be able to access these repositories remotely, all we have to do is run the svn server svnserve on the directory housing our new repositories:
$ svnserve -d -r /home/user/svn/
This will run svnserve in deamon mode while the machine is on. Don't forget setting permissions for each of the repositories. The two files to modify are svnserve.conf and passwd under the conf directory or each repository:
~/svn/project1/conf/svnserve.conf
~/svn/project1/conf/passwd
in the first file you set the permissions anon-access = none, auth-access = write, and point to the password file: password-db = passwd. In the second you set the allowed users and their corresponding passwords. If everything is set properly you should be able to checkout our projects from any other machine:
$ svn checkout svn://myserver.org/project1

Posted on:
2009.05.10 -0500

Tags:
code