2

The computer hosting our Subversion repository has died, and I'm trying to restore a backup onto a different computer. To minimize the hassle on the clients' end, I want to keep the same base URL, which is of the form:

https://servername/svn

That was hosted on a FreeBSD machine; the only machines I have available at the moment to restore the repository to are Windows. So I looked for a Windows-based Subversion server, and have tried both VisualSvn and CollabNet SubversionEdge, but ran into the exact same problem with both of them, which is this:

If I ask them to create a repository called "svn", they create a repository that is accessed as:

https://servername/svn/svn

If I instead ask them to create a repository named "/", or with no name, they simply give an error message saying that it's an invalid name.

How can I create a repository, using one of these products (or some other Windows svn server) that is accessed as just "/svn" instead of "/svn/somethingelse"?

Bob Vesterman
  • 1,127
  • 1
  • 11
  • 31

2 Answers2

2

You might have to (gasp!) manually configure it. To do that, you probably have to use CollabNet's Subversion Edge. VisualSVN is easier to use, but will overwrite any change you make in the Apache configuration unless you get the Pro version.

It's actually very simple. There are two ways to configure Subversion in Apache:

Way #1: Use a parent directory

<Location /svn>
   DAV svn
   SVNParentPath /opt/repos
   ....
</Location>

When you use this method, all Subversion repositories under /opt/repos will be in Subversion under the /svn directory. Most automated systems use this method because it gives you an easy way to configure multiple repositories with only a single Apache configuration.

If your Apache server is http://servername, and you have a subversion repository svn under /opt/repos/svn, your URL for that repo will be http://servername/svn/svn. The advantage is if you want another Subversion repo, you can simply add it to the /opt/repos directory, and it's all configured.

Way #2: Configure Each Directory

<Location /svn>
   DAV svn
   SVNPath /opt/repos/svn
   ....
</Location>

This allows you to configure one and only one Subversion repository each time. For each <Location ...>. However, this way allows you to specify the root directory. In this case, your URL would be http://servername/svn. As I said, you have to modify the Apache setting yourself, but it's not that difficult. The Subversion manual has the information you need.

If this was Linux/Unix, the files would be under /etc/httpd. There would be a conf directory containing the base httpd.conf file and a second directory called conf.d that contains the subversion.conf or svn.conf file that contains these changes.

With Collabnet on Linux, it's under /opt/collabnet/etc/conf or something like that. I have no idea where it's placed on Windows, but the file that needs changing will have the *.conf suffix, and will be fairly short.

David W.
  • 105,218
  • 39
  • 216
  • 337
  • Isn't this method breaking access to SVN via browser? – Ivan Jovović Feb 23 '15 at 21:33
  • This is how you link the Subversion repository to the Apache http directory you're using. Using VIsualSVN, it sets up the repos using `SVNParentPath` which makes it easy to add or remove repos. However, it means you have an _extra_ directory in your URL because those directories are mapped under ``. Using `SVNPath` will allow you to specify the `` directly, but you have to have multiple sections if you have multiple repos - which is good because you can define them differently. We use LDAP, and have different LDAP groups for each repo. – David W. Feb 23 '15 at 21:53
  • 1
    1. Getting "Pro" version never gave any benefits about modifying httpd.conf / httpd-custom.conf or for any other customizations. 2. The problem was solved in VisualSVN Server 3.5: https://www.visualsvn.com/company/news/visualsvn-server-3.5-released – bahrep Jan 15 '16 at 13:41
1

Use VisualSVN Server 3.5 or newer. Starting with version 3.5, it is possible to customize the URL prefix.

In VisualSVN Server 3.4 and older the URL to your repositories always looked like https://myserver/svn/myrepository. But it is now possible to adjust the URL to look like https://myserver/repos/myrepository or remove the prefix https://myserver/myrepository.

bahrep
  • 29,961
  • 12
  • 103
  • 150