0

My apache2 config for SVN:

ServerName server.org

 <Location /> DAV svn SVNPath /opt/svn/project.com AuthType Basic AuthName "Subversion Repository" AuthUserFile /etc/apache2/dav_svn.passwd Require valid-user </Location> SSLEngine on SSLCertificateFile /etc/apache2/ssl/server.pem SSLCertificateKeyFile /etc/apache2/ssl/server.key 

svnadmin create /opt/svn/project.com svn import /var/www/project.com file:///opt/svn/project.com/ 

And now I want to be able to have three copies of my project from /opt/svn/project.com:

/var/www/test1.project.com /var/www/test2.project.com /var/www/test3.project.com 

And I want to be able to commit this way:

cd /opt/svn/project.com svn add ./auth/ svn co ./ -c 'Comment' 

And I want to be able to update it on other hosts:

cd /var/www/test2.project.com svn up ./ 

What do I need to do?

1 Answer 1

0

If I understand your question correctly, you want to create a single authorization-enable repository, check it out to multiple locations, and work with it from any of those locations. This is pretty straightforward, and you should have no issues once you get your setup completed.

I think the following recommendations would ensure that you can do what you want, assuming that I am interpreting your question correctly.

1) Your Apache Location configuration should be as follows:

<Location /svn> DAV svn SVNPath /opt/svn AuthType Basic AuthName "Subversion Repository" AuthUserFile /etc/apache2/dav_svn.passwd Require valid-user </Location> 

This will allow you to access your multiple check-out points without conflict with your repository. Like anything else on your web server, the URLs cannot conflict, so you shouldn't make the repository root the same as the web server root (/).

Also, I changed your SVNPath value - this is supposed to be the directory where your repositories live, not the path to one of the repositories itself.

2) Create the appropriate structures. Your svnadmin create is correct. However, to ensure flexibility in future development, you need to create the trunk, branches, and tags directories under a project directory using svn --parents mkdir. Your resulting repository (accessed at the URL http://server/svn/project.com/) should have something like the following structure:

projectName branches tags trunk 

The trunk is where you do all your work. The branches tree is for forking or parallel development, and the tags tree is for static snapshots of your code. You really only need trunk, as that's the one you'll be checking out in your example.

3) Only Subversion modifies the /opt/svn/project.com tree to add/modify content. Because of that, you can only commit on a checkout, not the way you indicated.

If you have a file system with your intended content, you can either:

  • Check out the trunk and add your content under that:

    svn co http://server/svn/project.com/projectName/trunk/ /var/www/test1.project.com

    cp /var/www/project.com/foo /var/www/test1.project.com

    svn add /var/www/test1.project.com/foo

    svn ci /var/www/test1.project.com

  • Or import into the repository:

    svn import /var/www/project.com http://server/svn/project.com/projectName/trunk

4) To get multiple working copies, just check out the trunk (or an appropriate subdirectory) to each of your specified locations. Then any modifications committed in one checkout can be retrieved as you indicated using svn up.

2
  • Thanks a lot! Ive configured all as you said. But when I'm trying to checkout my repo from another server I'm getting: $ svn checkout project.com/svn svn: Repository moved temporarily to 'project.com/var/www/svn'; please relocate where /var/www = DocumentRoot in Apache2. If I'm not setting DocumentRoot at all then I'm getting relocate to htdocs :( What do I need to do?! Commented Aug 19, 2010 at 22:26
  • I think that there is still some confusion. The Subversion repository URL has to end with the directory you want a local copy of. Also, you should not check out to any directory in /opt/svn. Can you provide full paths and (mostly) real examples? Also can you provide any more detail on the error message you received (you can use back-ticks to highlight the message). Commented Aug 21, 2010 at 0:46

You must log in to answer this question.