Friday, July 14, 2006

Enabling Webbrowsing for Subversion

Just so that I absolve myself of all responsibility, it so happened that Apache 2.0.x was already installed in my system when I installed the Subversion Server and going by a few posts wrong versions of Apache had caused riots in the enabling webbrowsing of subversion. It seems that you need version lesser than 2.1 of apache and anything above it, well help yourself!

All one needs to do is edit httpd.conf and add

LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

For me, this was already added with the full path of the .so files in the bin directory of the subversion installation. i.e I had LoadModule dav_svn_module d:/Program Files/Subversion/bin/mod_dav_svn.so

I believe you can always copy these files into Apaches modules directory and then go ahead with the first 2 lines and everything should work.

Now add,

<location>
DAV svn
SVNParentPath d:/svnrepo/
</location>

This is so that the WebDAV browsing is taken care and I allow browsing of all repositories under my repository directory. If incase you need to enable browsing for only one repository you can go ahead and use SVNPath and give the name of the repository to which you want browsing enabled.

Now start Apache and type in http://localhost/svn/Test to browse the Test repository. Please note that /svn by itself will give you permission denied error. You need to type in the path of the repository also!

Now to provide some basic authentication to my repositories I used htpasswd of apache and added users with passwords and made the password file be available in the conf directory of apache. (htpasswd -c ../conf for the first time and without the -c the second time).

Edit httpd.conf and modify the location entry as follows
<location>
DAV svn
SVNParentPath d:/svnrepo/
AuthType Basic
AuthName "Subversion repository"
AuthUserFile d:/Apache2/conf/svn-auth-file
Require valid-user
</location>

Now restart Apache and everything should be fine, you can enter the website with the users you created via apache.

It is also possible that you can use an XSLT to control the output of the html over webDAV. Just add
SVNIndexXSLT "/svnindex.xsl" to the location tag of httpd.conf where svnindex.xsl is the xsl that you want to use for transformation.

For further tweaking the options please visit the Subversion Book.

No comments: