EOL July 1 2018 - Support for this service is deprecated and being phased out. See SVN_EndOfLife for details on transitioning your repositories.

Everyday subversion usage, and general notes, are at UsingSubversionAtCSAIL.

Creating a Subversion repository


1. Make sure subversion is installed on the workstation(s) you will use -- See UsingSubversionAtCSAIL#Prerequisites

2. Choose the access method(s) you and your collaborators will use
  • The default, svn+ssh://, is easier to set up and simpler to maintain. All collaborators need to have CSAIL accounts. Access is controlled through the filesystem -- meaning AFS commands like pts mem and fs sa.
  • https:// allows collaborators outside of CSAIL. Usernames and passwords are chosen and maintained arbitrarily by you. Access is controlled through .htpasswd files (and through AuthzSVNAccessFile syntax for detailed access rules).

3. Determine the AFS path for your repository
  • All repositories should be created in the appropriate group, project, or personal directory in the CSAIL AFS cell. If your repository is for use across your entire research group, we suggest that you create a directory called REPOS in the top-level of your group's directory. If your repository is for more personal projects, keeping it in REPOS in your home directory makes sense.
  • For the following examples, we chose the path /afs/

4. Determine the Repository URL
  • For svn+ssh://, prepend svn+ssh:// to the AFS path above. For our example, that gives svn+ssh://
  • For https://, you can map an arbitrary short name yourself, as in --> /afs/csail/.../your-repo. For our example, we chose

Creating a repository

SSH to before doing any direct repository manipulation:
csailuser@somehost:~$ ssh
csailuser@svn:~$ cd /afs/csail/group/tig
csailuser@svn:/afs/csail/group/tig$ mkdir -p REPOS
csailuser@svn:/afs/csail/group/tig$ fs la .
Access list for . is
Normal rights:
  tig rlidwka
  system:anyuser l

Here, make sure that system:anyuser l or system:authuser l appears. If not, you may get "access denied" errors even if permissions are otherwise correct.

Set appropriate AFS permissions:
  • Permissions on the parent directory(ies) of REPOS ("Access list for .") should include either system:anyuser l or system:authuser l
  • Collaborators who will access your repository using svn+ssh:// need to have at least rlidwk permissions, either as a member of a group (as in tig above), or named directly.
  • To use https://, you must see the line svn rl.
  • Before creating your repository, create AFS groups and/or update permissions as necessary.
    • If you skip this step, you will need to recursively set permissions on your repository directory and all its subdirectories later.

Then actually create the repository:
csailuser@svn:/afs/csail/group/tig$ cd REPOS/
csailuser@svn:/afs/csail/group/tig/REPOS$ ls
csailuser@svn:/afs/csail/group/tig/REPOS$ svnadmin create --fs-type=fsfs ./test_repo
csailuser@svn:/afs/csail/group/tig/REPOS$ ls
csailuser@svn:/afs/csail/group/tig/REPOS$ cd test_repo/
csailuser@svn:/afs/csail/group/tig/REPOS/test_repo$ ls
README.txt  conf  dav  db  format  hooks  locks

Additional steps to set up https:// access

To allow collaborators who don't have CSAIL accounts to check out/in modifications (AUTH)

  1. Give the svn server access to your repository (recursively). From a CSAILUbuntu host:
    csailuser@svn:~/REPOS$ fsr sa test_repo svn write
    then test that permissions were set correctly:
    csailuser@svn:~/REPOS$ fsr la test_repo
    Access list for test_repo is
    Normal rights:
      svn rlidwk
      [...Repeated for other rights]
    [...Repeated for other directories]
  2. Create a directory to hold access control files. It should have svn read (that's rl) permissions and be writable only by those you trust to futz with passwords to the repository.
  3. Create an AuthUserFile in that directory, using the htpasswd command, with at least one username/password pair.
  4. (Optional) Customize access control based on user logged in, directory of the repository, etc. The Subversion Book contains details for constructing an "access file", or see example files below.
  5. Create the mapping at: (CSAIL Certificate required). This page takes minutes and minutes to load -it is what it is
    • Path: path to your repository, without a trailing /
    • Use Authentication: YES
    • AuthName: enter something to be displayed above the password prompt (as the "authorization realm") when people who access the https:// URL manually.
    • Password file: (the AuthUserFile from step 3)
    • Use ACL File and ACL File: (optional, the "access file" from step 4)
    • Verify all the above fields, then turn Enabled to YES.
  6. Hit "Commit". If it fails, double-check step 1. You may also find clues on within /var/log/apache2/svn.error.log .

To publish the contents of your repository read-only to the world (ANON)

Note: Under this configuration, anyone who checks in changes must use svn+ssh://
  • Follow "auth" steps, but skip steps 2 through 4.
  • In Step 5, Use Authentication: NO; Use ACL File: YES; ACL File: /afs/csail/ proj/www/

To publish your repository read-only to the world, AND still allow https:// access for collaborators (AUTH+ANON)

  • Follow "auth" steps, but Step 4 is required -- otherwise anonymous users will be able to write to your repository. Sample access file:
    * = r
    @developers = rw
    developers = htaccessuser1, htaccessuser2, ... htaccessusern
  • In Step 6, Fill in ACL File; Use Authentication: YES; Also Allow Anonymous: YES.

Next steps

Once you have created the repository, you will likely never touch it directly. All modifications to the repository are done by way of edits you make to local copies (called "working copies"). You can be sure that setup is complete, and that the repository URL is accurate, after you have checked out a working copy.

Importing existing files into a repository (optional)

NOTE: Prerequisites at UsingSubversionAtCSAIL#Prequisites apply.

Let's say you have an existing codebase tree in your home directory, in a subdirectory called project_x. You will need to do an initial import of your code into Subversion's format. The following example shows us importing that code base into the newly created repository.

csailuser@somehost:~/Work$ ls
csailuser@somehost:~/Work$ svn import ./project_x/ svn+ssh:// --message "initial import of project_x"
Adding         project_x/foo
Adding         project_x/bar
Adding         project_x/pub
Adding         project_x/pub/beer
Adding         project_x/baz

Committed revision 1.

The svn import command above tells Subversion to take the contents of your local directory "project_x" and import it into the new, empty repository. Note that the path to the repository is a svn+ssh URL. This directs your local svn client to first ssh to, and then use its copy of svn to safely perform the modifications.

Adding hooks to a subversion repository

Send email after every commit

  1. Double-check that no active checkouts are using file:///afs/csail... URLs. If they are use svn switch -relocate to move them to svn+ssh or https.
  2. cd $REPO_AFS_PATH/hooks
  3. cp post-commit.tmpl post-commit
  4. edit the last line of post-commit. remove and replace it with
    -h ${YOU_OR_LIST}
    then save.
  5. Make sure that the post-commit file is executable: chmod +x /afs/

Now, after every commit that comes in via svn+ssh or https, ${YOU_OR_LIST} should receive email. As long as you don't make any commits via file:///, this is as supported as the rest of subversion (which is to say, we have some facility with it and can probably get it to work for you, but can't promise to make every permutation of every feature work on every platform).

Your hook here

Feel free to edit this page and add other commit hooks you've used succesfully.

-- ArthurProkosch - 22 Feb 2011
Topic revision: 09 Apr 2018, JonProulx

MIT Computer Science and Artificial Intelligence Laboratory


  • About CSAIL
  • Research
  • News + Events
  • Resources
  • People

This site is powered by Foswiki MIT: Massachusetts Institute of Technology