Thursday, April 9, 2009

HOWTO : SVN over HTTPS

Create the repository
  1. $ svnadmin create /home/svn/repo/svn  

Install RPM mod_dav_svn
  1. $ yum install mod_dav_svn  

Config who can access the repository and their permissions (r or w) /home/svn/conf/users-access-file
  1. [/]  
  2. gulden = rw  
  3. other = r  
  4. [/privaterepo]  
  5. *=  

  • "gulden" user can access the the "/" repository with read and wright (rw) permissions
  • "other" can access the the "/" repository with read (r) permission
  • No one can access the "/privaterepo" repository

Create the Users password file
  1. $ htpasswd /home/svn/conf/passwd gulden  

Edit Apache configuration file: /etc/httpd/conf.d/subversion.conf
  1. LoadModule dav_svn_module     modules/mod_dav_svn.so  
  2. LoadModule authz_svn_module   modules/mod_authz_svn.so  
  3.   
  4. <virtualhost 443="">  
  5. ServerName myhost.com  
  6. ServerAlias svn.myhost.com  
  7. <location>  
  8.  Order allow,deny  
  9.  Allow from all  
  10.  DAV svn  
  11.  SVNParentPath /home/svn/repo  
  12.  # our access control policy  
  13.  AuthzSVNAccessFile /home/svn/conf/users-access-file  
  14.  # try anonymous access first, resort to real  
  15.  # authentication if necessary.  
  16.  Satisfy Any  
  17.  Require valid-user  
  18.  #  how to authenticate a user  
  19.  AuthType Basic  
  20.  AuthName "My Subversion repository"  
  21.  AuthUserFile /home/svn/conf/passwd  
  22. </location>  
  23. </virtualhost>  

Checkout a project
  1. $ svn co https://svn.myhost.com/svn/foo/trunk