Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My apache2 config for SVN:


    <Location />

            DAV svn
            SVNPath /opt/svn/

            AuthType Basic
            AuthName "Subversion Repository"
            AuthUserFile /etc/apache2/dav_svn.passwd

            Require valid-user

    SSLEngine on
    SSLCertificateFile    /etc/apache2/ssl/server.pem
    SSLCertificateKeyFile /etc/apache2/ssl/server.key

svnadmin create /opt/svn/
svn import /var/www/ file:///opt/svn/

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


And I want to be able to commit this way:

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

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

cd /var/www/
svn up ./ 

What do I need to do?

share|improve this question

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

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/ should have something like the following structure:


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/ 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:

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.

share|improve this answer
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 svn: Repository moved temporarily to '';; 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?! – tst Aug 19 '10 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). – mlschechter Aug 21 '10 at 0:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.