Set up a Subversion repository

Overview

This article explains how to create a Subversion repository on your DreamHost server and connect to it securely over svn+ssh.

DreamHost supports hosting Subversion repositories using svn+ssh. Authentication is handled by SSH, so you connect with your existing DreamHost shell credentials or an SSH key, and no separate Subversion password file is required.

Prerequisites

These steps assume you are setting up your SVN repository on your DreamHost server, and that you have a DreamHost shell account with SSH access. View the SSH overview article for instructions on logging in to your server.

Things to know before you start

  • Connect to your repository over svn+ssh, which uses SSH for authentication and transport.
  • The svn:// protocol (the standalone svnserve daemon) and the Apache mod_dav_svn module are not supported on DreamHost.

How do I create a repository?

The following steps create a repository inside a dedicated folder in your home directory.

This example uses the repository name my_project, and the repository location is in the /home/username/svn/ directory.

Initialize the repository

It is recommended to keep all of your repositories within a dedicated folder in your user's home directory.

  1. Create the svn directory in your home directory:

    [server]$ mkdir -p ~/svn
  2. Use the svnadmin command to create your repository:

    [server]$ svnadmin create ~/svn/my_project

Configure repository access

Edit the repository's configuration to control who can read and write it. When you connect over svn+ssh, SSH performs authentication, so the conf/passwd file is not used and you do not set a password-db.

  1. Open the svnserve.conf file in your repository's conf directory:

    [server]$ nano ~/svn/my_project/conf/svnserve.conf
  2. Set the following minimal configuration, then save the file:

    [general]
    anon-access = none
    auth-access = write

Check out the repository

Connect over svn+ssh using your DreamHost shell user, your domain, and the absolute path to the repository. Replace username, example.com, and my_project with your own values.

  1. Check out the repository:

    [local]$ svn checkout svn+ssh://username@example.com/home/username/svn/my_project

If you configured svnserve with a repository root, you can instead use a shorter URL:

[local]$ svn checkout svn+ssh://username@example.com/my_project

How do I let multiple people access a repository?

If multiple developers share a single shell account, Subversion cannot distinguish between them by default, so commits are not attributed individually. To assign a different Subversion username to each SSH key, configure forced commands in ~/.ssh/authorized_keys together with svnserve --tunnel-user.

FAQs

Does DreamHost support the svn:// protocol or Apache mod_dav_svn?

No. On DreamHost, the svn:// protocol (the standalone svnserve daemon) and the Apache mod_dav_svn module are not supported. Connect to your repository over svn+ssh instead.

Do I need to create a conf/passwd file for my repository?

No. When you connect over svn+ssh, authentication is handled by SSH using your DreamHost shell credentials or SSH keys, so the conf/passwd file is not used.

Can several people commit to the same repository?

Yes. You'll need to share a single shell account and use forced commands in ~/.ssh/authorized_keys with svnserve --tunnel-user to assign a Subversion username per author. Each unique author will need to provide you with an SSH key to access.

See also

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?