How do I setup a simple SVN server?

lmat - Reinstate Monica picture lmat - Reinstate Monica · Mar 12, 2013 · Viewed 7k times · Source

I have a working repository that I created a long time ago, and now I'm trying to set up another, but I'm having great difficulty. Here's what I did to create the second one; and I would expect this to work:

U:\repos>svnadmin create repo1
U:\repos>echo password-db = passwd >> repo1/conf/svnserve.conf
U:\repos>echo auth-access = write >> repo1/conf/svnserve.conf
U:\repos>echo user1 = user >> repo1/conf/passwd
U:\repos>cd repo1
U:\repos\repo1>svnserve -d

And in another terminal:

U:\>mkdir wc
U:\>cd wc
U:\wc>svn co svn://localhost/repo1
svn: E210005: Unable to connect to a repository at URL 'svn://localhost/repo1'
svn: E210005: No repository found in 'svn://localhost/repo1'
U:\wc>

The other repository is configured in the same way at u:\repo. What's going on?

Answer

lmat - Reinstate Monica picture lmat - Reinstate Monica · Mar 12, 2013

First, cd repo1 is superfluous: svnserve doesn't care about the working directory in this instance.

To make your example work, change -d to -d -r \repos.

Alternatively, you could change your co command to svn co svn://localhost/repos/repo1.

When svn co is run, it's using the URL to tell svnserve where to look for the repo. This path by default is relative to /, not the working directory where svnserve was launched! The existing repository works because the repo happens to be in /, not because svnserve was launched from /repo. When you want the path of your repo to be referenced from somewhere other than /, use the -r [--root] option of svnserve.

This means that a repository stored at u:\repos\repo1, when launched with svnserve -r u:\repos must be referenced by the url /repo1 (svn://localhost/repo') rather than /repos/repo1. Capish?