Svn

From MusiKiwi

Jump to: navigation, search

Contents

Install necessary Modules

In order to get Apache httpd web server 2.0 to host svn repositories, install the following packages:

  yum install mod_dav
  yum install mod_dav_svn

By default, these are installed to /usr/lib64/httpd/modules. If Apache is installed elsewhere, you may have to copy two files:

  cp /usr/lib64/httpd/modules/mod_dav.so /usr/local/apache2/modules
  cp /usr/lib64/httpd/modules/mod_dav_svn.so /usr/local/apache2/modules

Now add the following lines to httpd.conf:

  LoadModule dav_module modules/mod_dav.so
  LoadModule dav_svn_module modules/mod_dav_svn.so

Configure Repository Location

To direct Apache to your repository, add the following lines to httpd.conf:

  <Location /repos>
    DAV svn
    SVNPath /var/svn/repository
  </Location>

Create the Repository

Now create a folder in /var/svn:

  mkdir /var/svn
  

You can now create the repository itself using svnadmin:

  svnadmin create /var/svn/repository

Now import the initial files:

  svn import <full path to source directory> file:///var/svn/repository/<project_name> -m "first import"   

Be sure that the apache user owns the directory where the repository is hosted:

  chown -R apache:apache /var/svn/repository

Use Basic Authentication

Although passwords are sent in the clear (unencrypted), a basic password authentication scheme can be configured as follows:

  <Location /repos>
     ...
     AuthType Basic
     AuthName "Subversion repository"
     AuthUserFile /etc/svn-auth-file
     Require valid-user
  </Location>

Passwords for users can be set up with the htpasswd command:

  htpasswd -cm /etc/svn-auth-file harry
  New password: *****
  Re-type new password: *****
  Adding password for user harry

Configure Environment Variables

In your home directory, edit .bashrc:

  export SVN_EDITOR=/bin/vi

SVN Usage

How to Check out

To check out a working copy:

  svn co http://www.website.com/repos/project

Via ssh:

  svn co svn+ssh://username@server.com/path/to/folder

Go back in Time

To revert to an earlier version:

  svn log
  svn update -r 2

Error: Aborting commit: <filename> remains in conflict

  svn remove --force filename
  svn resolve --accept=working  filename
  svn commit

List files in Repository

  svn list --depth infinity

References

http://svnbook.red-bean.com/nightly/en/svn.serverconfig.httpd.html

http://www.abbeyworkshop.com/howto/misc/svn01/

http://svnbook.red-bean.com/

Personal tools