How to set up a SVN server on Windows

Getting a SVN Server running properly on WinXP/2000/Vista can be a confusing process, here's how I do it:

  1. Install TortioseSVN from http://tortoisesvn.net/downloads
  2. Right click on an empty folder and choose TortoiseSVN -> Create repository Here
  3. Install Apache Windows Server from http://httpd.apache.org/download.cgi
  4. Get 'Subversion Win32 binaries for Apache' from http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=8100 and put in C:\svn
  5. Copy C:\svn\bin\mod_authz.svn.so and C:\svn\bin\mod_dav_svn.so to C:\Program Files\Apache Software Foundation\Apache2.2\modules
  6. Edit C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf
    Add/uncomment the following lines to the LoadModule section:
    LoadModule dav_module modules/mod_dav.so
    LoadModule dav_fs_module modules/mod_dav_fs.so
    LoadModule dav_svn_module modules/mod_dav_svn.so
    LoadModule authz_svn_module modules/mod_authz_svn.so
    
  7. Add the following to the end of the file:
    
    DAV svn
    SVNPath (path to the svn repository you made)
    AuthType Basic
    AuthName "Subversion repository"
    AuthUserFile passwd
    #AuthzSVNAccessFile svnaccessfile
    
    #allow only authenticated users to access
    Require valid-user
    
    # allow read access to all, write access to authenticated users only
    #Order deny,allow
    #
    #      Require valid-user
    #
    
    
  8. Next you need to create some users that can access your SVN repository through Apache
    Open command prompt at C:\Program Files\Apache Software Foundation\Apache2.2
    bin\htpasswd.exe -c passwd (username you want to add)
    
    Note: it will prompt to set the user's password
  9. run the Apache Server
  10. On the router, make sure to enable port forwarding for TCP port 80 (www) and 3690 (svn)
  11. Test the Apache Server to make sure it's working:
    http://localhost -> does the web server work?
    http://localhost/svn -> does mod_dav, svn modules & authentication work on the server?
    http://38.107.191.111 -> (this is your external ip) does remote access work for the server?
  12. Next you need to set up authentication for the actual SVN service (this is different than the Apache authentication in step 8).
    Go to the directory you created your repository in (step 2) and go into the conf subdirectory.
    edit the passwd file with a text editor and add a user and password in there (there should be commented out examples):
    [users]
    testusername = testpassword
    
  13. Open svnserve.conf in that same directory with a text editor.
    make sure you have something like the following in there that's uncommented:
    anon-access = none       # this disallows anonymous people from accessing the repository, you can set this to read also
    auth-access = write      # read/write access for authenticated users
    password-db = passwd     # make sure this is uncommented, it's commented by default
    
  14. Next we need to install the SVN service
    Open command prompt at C:\svn\bin
    sc create svn.local binpath= "\"c:\svn-win32-1.5.2\bin\svnserve.exe\" --service --root F:\work\Andrograde\svn" displayname= "Subversion Repository" depend= Tcpip
    
    Next go to Services and turn the service on
    services.msc
    go to Subversion Repository -> click start (optionally set it to Automatic)
    
  15. Test the repo-browser:
    right click on a folder -> tortoiseSVN -> Repo-browser
    svn://localhost -> test if it works internally
    svn://38.107.191.111 -> (this is your external ip) test if it works remotely
Other things to check if it's not working
  1. Make sure the svn versions are the same throughout Apache, SVN and TortoiseSVN. If they're not the same version, you will get something like:
    (20014)Error string not specified yet: Expected version '3' of repository; found version '5'
    
  2. You get in TortoiseSVN
    No access allowed to this repository
    
    Make sure you have step 12 and 13 correct.


26 Comments
Error

DAV svn
SVNPath (path to the svn repository you made)
AuthType Basic
AuthName "Subversion repository"
AuthUserFile passwd
#AuthzSVNAccessFile svnaccessfile

#allow only authenticated users to access
Require valid-user

# allow read access to all, write access to authenticated users only
#Order deny,allow
#
# Require valid-user
#


with this apache don't start]


(i use xampp)
P. Laxmi
coild not able to start subversion repositiry
P. Laxmi
getting error 1053, Plz suggest
Pepsi1x1
in response to Error it should look like this, the author missed off the location tags
<Location /svn>
DAV svn
SVNParentPath c:\svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile c:\svn\htaccess
Require valid-user
</Location>
Pepsi1x1
disregard the above formating removes the tags on this page try this link http://www.dmbcllc.com/Articles/SubVersion/ServerInstallation/tabid/173/Default.aspx
Pepsi1x1
Also another thing to note is that svn doesnt work on windows with apache 2.2+
Kevin C
Im getting the error: The requested operation has failed
suchezi
try this

<Location /svn/>
DAV svn
SVNParentPath c:\svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile c:\svn\htaccess
Require valid-user
</Location>
Sanjay
Could not start Subversion Repository service
Rajkumar
Good article Thanks,


Rajkumar
Sanjay , you need set system variables for subversion , this will solve problem in starting SVN,

1st : First we set Path in system Variable -> Right Click On My
Computer -> Properties ->Advanced ->Environment Variable.

Then Edit The Path to C:\programe File \SubVersion\bin

2.Create new system variable as SVN_Edit and give variable value as
C:\ Program File \windows\ notepad.exe

3.: Open command promte " CMD" Type
cd:\sc create svnserve binpath= "c:\Programs\Subversion\bin\svnserve.exe --service -r
D:\ProjectFiles" displayname= "Subversion" depend= Tcpip start= auto



sc is command to create service in windows,
svnserve is service name
binpath : path to executiable file
--service is to start service at startup
D:\ProjectFiles : folder which you created in D-drive well act as SVN Repository
displayname : service name in services console
Start = auto is set to automatic start at system boot
depend= Tcpip works on ip


Then you get this result [SC] CreateService SUCCESS , if every is fine your SVN service is ready .......

Thats all Sanjay







Sunil
Appache is not starting
Sunil
Can you please help me in that
Chrystopher
Hi, I have followed the following procedure and everything seems to work well locally. With some minor directory changes i was able to setup svn properly but when trying to import my project into Eclipse via the subclipse plugin, it seems i cannot connect to my svn / apache server, i have specified svn://publicipadress as well as http://publicipadress but it doesn't seem to work. I get a Folder " does not exist remotely
Will
Did you enable port forwarding for the svn and http ports on your router to your computer?
vikas
no connection could be made because the server actively refused it, when use svn://<my-ip>/svn
umbyersw
Thank you, this post helped me solve my 'no access allowed to this repository' error!
Chrystopher
Got it running after all thanks for help, but new router is being a bitch to config.
ewrwer
ewrwerwerw
Miki Avramovic
Parameter for AuthUserFile is full path po file that created by step 8.
Example: AuthUserFile "c:\Program Files\Apache Software Foundation\Apache2.2\passwd" That file have information about username and password.

Miki Avramovic
I wrote this and work fine:

<Location /svn>
DAV svn
#SVNParentPath c:\R1
SVNPath c:\R1
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile "c:\Program Files\Apache Software Foundation\Apache2.2\passwd"
Require valid-user
</Location>

Comment:
c:\R1 is SVN repository folder. I created it in step 2 of this manual

For first test I used Firefox:
http://localhost/svn. After that i wrote username and password that i defined in step 8.
hardik
thanks a lot frnzz
reecetopher
fun
sunil
hi, Could you plz help me how to setup Subversion in a detailed way.How to set path variables,repository and all...i am new to this subversion
Chad
I got all this working fine, but I am wondering how I would go about setting this up for multiple repositories to all be accessed remotely
Jack Repenning
The Subversion binary installer links in the article have become stale. Current installers suitable for these directions may be found in several places, including
http://www.open.collab.net/downloads/subversion