Tag Archives: repository

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 
SSLRequireSSL 
ErrorDocument 404 default 
</Location>

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

Ubuntu Server: Steps to Create a New SVN Repository and Add Users for it Tips, Tricks and Tutorials 17 DEC 2010

To add SVN repositories and give existing user accounts access to it is not entirely a one step process in Ubuntu. So this is how you do it…

First, browse to the folder in which you want to generate your SVN repository and create the respository folder:

cd /home/svn
mkdir projectname

Next, instruct SVN to generate the necessary file structures required into your repository folder:

sudo svnadmin create projectname

Once this has completed, the next step is to open up the repository to the world by making use of the Apache web server. To do this, we need to assign the necessary folder access permissions:

sudo chown -R www-data:svn projectname
sudo chmod -R g+rws projectname

Next, we need to add the new SVN repository details under Apache’s configuration:

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

Add to the bottom of the file:

<Location /svn> 
DAV svn 
SVNPath /home/svn/projectname 
AuthType Basic 
AuthName "Projectname SVN Repository" 
AuthUserFile /etc/subversion/passwd 
Require valid-user 
ErrorDocument 404 default 
</Location>

And finally? Restart the Apache service.

sudo service apache2 restart

Next, you must create /etc/subversion/passwd file. This file contains user authentication details.

If you have just installed SVN, the passwd file will not yet exist and needs to be created using the “-c” switch. Adding any users after that should be done without the “-c” switch to avoid overwriting the passwd file.

To add the first entry, ie.. to add the first user, you can run the following command:

sudo htpasswd -c /etc/subversion/passwd user_name

It prompts you to enter the password. Once you enter the password, the user is added.

To add more users after that, you can run the following command:

sudo htpasswd /etc/subversion/passwd second_user_name

If you are uncertain whether the passwd file exists, running the command below will tell you whether the file already exists:

cat /etc/subversion/passwd

Now, to access the repository you can run the following command:

svn co http://hostname/svn/myproject myproject --username user_name

Done!