Subversion

Revision 8 as of 2005-10-07 23:40:00

Clear message

SubVersion for repository administrators (using Apache)

In order to create a repository you need to follow these steps (do it with sudo or in a root shell):

Install the needed packages, which are in the Universe repository. For more information on adding repositories, see AddingRepositoriesHowto.

 apt-get install subversion
 apt-get install libapache2-svn

Create a virtual host in Apache2's configuration file /etc/apache2/apache2.conf and point it to /home/svn. Configuration sniplet:

  <Location /faq>
    DAV svn
    SVNPath /svn/faq
    AuthType Basic
    AuthName "Documentation Team Repository"
    AuthUserFile /etc/subversion/passwd
    <LimitExcept GET PROPFIND OPTIONS REPORT>
      Require valid-user
    </LimitExcept>
  </Location>

(Important: Don't use a DocumentRoot setting for this virtual host!")

Restart apache (if needed):

 /etc/init.d/apache2 reload

Create the repository:

 svnadmin create /svn/faq

Create a password file:

 htpasswd2 -c /etc/subversion/passwd [username]

The svn repository should have access to user who runs apache process. In this case, it's www-data. He belongs to www-data group. So, you should give permissions to svn repository as follows:

 chown www-data.www-data /svn/faq -R

Now, try accessing it:

 lynx http://server/faq

(You will not be prompted for credentials. That's normal.)

Try to check out the file:

 svn co http://server/faq

Voila. The repository is set up.

SubVersion for repository users

To checkout (=download) the files in the repository for the very first time run this command::

 svn co http://server/faq

Don't worry about other people working on the same files. Just do your changes to the files and when you seem to have a stable state (make sure everything works well enough so not everything will break for others) you should check in your work::

 svn ci

(Only when committing your changes you will be prompted for your username and password.)

Run the following command regularly to get the changes from other contributors::

 svn update

If you want to add new files to the repository::

 svn add [filename]

To get a status of which files have changed::

 svn stat

To know more about usage details, you can refer the manual page. For example, to know more about update sub-command you can try::

 svn update --help

SubVersion for local repositories

This type of istallation is used when you want subversion to track your local files but don't want/need to put it on a host. You can create a local repository and access it directly. This repository is not password protected and it's permissions depend on the filesystem's permissions.

Install the needed packages (as root or with sudo):

 apt-get install subversion

Create the repository (with your user):

 svnadmin create /home/joe/repository

The url to your repository is it's path preceeded with file://. For example to checkout you would do the following::

 svn co file:///home/joe/repository

Resources

* [http://subversion.tigris.org/ Subversion's Official Homepage]

* [http://svnbook.red-bean.com/ Online free book: Version Control with Subversion]

*Christoph Haas, Tiago Cogumbreiro*

CategoryDocumentation CategoryCleanup