SVN Commit Error: Repository Moved Temporarily; Please Relocate Tips, Tricks and Tutorials 17 FEB 2014

svn-logoI encountered a rather strange (and frustrating!) error today which was completely blocking me from committing any files into my SVN repo. After a lot of fiddling and tweaking (all unsuccessful) and finally just destroying the whole damn thing to start afresh, I did stumble across the cause and solution via Google, which means that obviously I now need to save it here for my own record.

The error Subversion was returning to me after every commit attempt read something along the lines of:

svn: Repository moved temporarily to 'xxxyyyzzz'; please relocate

The problem as it turns out is the fact that both the project webserver (in this case Apache) and Subversion are installed on the same server and thus share an Apache configuration (because you are probably using the dav_svn module to access your SVN repo).

Now if you are being clever with your 404 handling for your web project and maybe doing some redirects, and this errorDocument handler is specified on your default site configuration, then obviously your SVN module is affected by this as well. So for the one or two occasions where your SVN repo perhaps references a file that no longer exists in itself, your custom 404 redirect handler screws with the necessary SVN return error, thus resulting in the rather cryptic error message outlined above.

Luckily, it turns out that solving this issue is in fact very simple. All you need to do is edit your dav_svn.conf file:

sudo nano /etc/apache2/mods-enabled/dav_svn.conf

and add the default Apache 404 error document directive to it! A typical SVN configuration might then look like this:

<Location /svn> 
DAV svn 
SVNPath /var/svn-repos/svn 
AuthType Basic 
AuthName "Subversion Repository" 
AuthUserFile /etc/apache2/dav_svn.passwd 
Require valid-user 
ErrorDocument 404 default 

So yeah, I just wasted a lot of time by not finding this nugget via Google first.

Related Posts:

About Craig Lotter

South African software architect and developer at Touchwork. Husband to a cupcake baker and father to two little girls. I don't have time for myself any more.