Table of Contents
Accessing a Subversion Repository
This page explains how to access a Subversion (svn) repository. This page is primarily for UNIX and Mac (Leopard) users. Windows instructions are here. See this page for setup and administrative information.
Creating an SSH Key for Access to the Repository
On a UNIX system, use ssh-keygen
to create a public/private key pair. Give it a host-specific name (to distinguish it from any other ssh keys you may have) and store it in the default directory (~/.ssh
):
% ssh-keygen -t rsa -f ~/.ssh/id_rsa_svn1
ssh-keygen
will prompt you for a passphrase to lock the key. This protection is not necessary; you can skip it by pressing ENTER
twice. ssh-keygen
will create two files in your ~/.ssh
directory, with the private key in id_rsa_svn1
and the public key in id_rsa_svn1.pub
.
Send the repository administrator a copy of your public key file, id_rsa_svn1.pub
, who will then create an svn account for you and tie your public key to that account.
Setting Up Your Working Environment for Repository Access
While waiting for the administrator to create your svn account, you can read the svn tour or other documentation and set up your UNIX environment for svn access.
If you're only dealing with this one repository (i.e., you're not involved in any other projects that use svn), then it is simplest to just set the SVN_SSH
environment variable to turn on ssh key access and log you in to the server account. For example, bash users edit ~/.bashrc
to include (note that svn_login
is specific to the host where the repository is stored; your administrator should provide this information):
SVN_SSH="ssh -i $HOME/.ssh/id_rsa_svn1 -l svn_login" export SVN_SSH
For Mac users (and perhaps any UNIX users) it might be necessary to add a “-q” option to the ssh command to suppress a spurious “Killed by signal 15” message.
Once your svn account is created, cd to a suitable directory and get a copy of the repository (host
is also site specific and should be provided by your administrator):
% svn checkout svn+ssh://host.cs.purdue.edu repository
These commands create a repository
subdirectory with a complete copy of the source code repository. The repository may be organized as recommended by the svn community: one directory per “project”, with each project containing a branches
, tags
, and trunk
subdirectory. You'll notice that the repository directory contains two subdirectories: skeletons for “project1” and “project2”. The main place to create files (e.g., source code) is in the trunk
directory. Start there.
Creating a New Project
The basic steps for adding a new project are to start in the repository directory, make sure you are up-to-date, create the directory structure, add to the project, then commit:
% cd repository % svn update % mkdir project3 project3/branches project3/tags project3/trunk % svn add project3 % svn commit
Create your first file(s) in project3/trunk
.