Creation and maintenance of Subversion repositories
Reviewed by Murray Anderegg 02/27/2013
- What is a Subversion repository?
- Creation of a Subversion repository
- Access to a Subversion repository
- Using Subversion/CVS tutorials
- How much space does each user get in a Subversion repository?
- Web based subversion repositories
- Access to Subversion repositories for non-department users
'Subversion is a centralized system for sharing information. At its core is a repository, which is a central store of data. The repository stores information in the form of a filesystem tree—a typical hierarchy of files and directories. Any number of clients connect to the repository, and then read or write to these files. By writing data, a client makes the information available to others; by reading data, the client receives information from others.
So why is this interesting? So far, this sounds like the definition of a typical file server. And indeed, the repository is a kind of file server, but it's not your usual breed. What makes the Subversion repository special is that it remembers every change ever written to it—every change to every file, and even changes to the directory tree itself, such as the addition, deletion, and rearrangement of files and directories.
When a client reads data from the repository, it normally sees only the latest version of the filesystem tree. But the client also has the ability to view previous states of the filesystem. For example, a client can ask historical questions such as “What did this directory contain last Wednesday?” and “Who was the last person to change this file, and what changes did he make?” These are the sorts of questions that are at the heart of any version control system: systems that are designed to track changes to data over time.
To create a Subversion repository on the departmental CVS server send a request to firstname.lastname@example.org asking for the creation of a personal CVS repository, or for the creation of a project repository related to a research group or class in the department. Personal CVS repositories are created on the CVS server in /cvs/user/<userid> and project repositories are created on the CVS server in /cvs/proj/<project name>. After the CVS repository is created the subversion repository must be created. Login to cvs.cs.unc.edu and create a repository with: svnadmin create <path-to-top-of-repository>
If you wish to run multiple subversion repositories on the CVS server, then you will need to create subdirectories for each repository and create a subversion repository in each subdirectory.
Access to any Subversion repository in /cvs/user or /cvs/proj is currently ONLY using SSH and only available to users with an account in the Department of Computer Science. Access to web (https://cvs.cs.unc.edu) based repositories is currently managed by Computer Services, and should be requested by sending email to email@example.com.
We strongly suggest that you use public/private key authentication with SSH, so you are not prompted for a password for each file that is committed. This makes the process of committing Subversion changes more atomic and less painful. A document describing how to setup public/private key authentication from Linux and Windows is available here.
The Subversion repository is currently residing on a Linux server in an ext3 filesystem running POSIX draft file ACLs. The process of sharing a repository and collaborating with others will require modifying the ACLs. For information on Linux file ACLs, see the man pages for setfacl and getfacl, and see these two web pages: POSIX Access Control Lists on Linux and POSIX ACLs in Linux.
Here is an example on adding user anderegg to a repository in /cvs/user. You need to set extended ACLs on your repository. Login to cvs and:
cd /cvs/user/<your repository>
setfacl -R -m user:anderegg:rwX .
setfacl -R -d -m user:anderegg:rwX .
To remove access for user anderegg:
cd /cvs/user/<your repository>
setfacl -R -x user:anderegg .
setfacl -R -d -x user:anderegg .
NOTE: Both commands need to be run to make a change in permissions on everything existing now (without -d) and everything created in the future (default = with -d).
There is a cron job that sweeps through the /cvs/user and cvs/proj repositories and performs a chown to the owner of the repository of everything within, in case a different user creates files within the repository.
It is far beyond the scope of this document to describe all of the details of using Subversion. A comprehensive tutorial has been copied here.
There are other tutorials available online. Recommendations on other tutorials are welcome and should be submitted to the maintainer of this document.
The process of getting started with Subversion may take a bit of time, so plan to try the Subversion repository and try some tutorials to get up to speed.
Users are allocated 500MB of space for personal Subversion repositories. Projects are allocated 1GB of space for a Subversion repository.
As of late 2008, the department has added support for web-URL accessible Subversion repositories. These repositories are not accessible through SSH. Instead the repository is accessed by a URL beginning with:
Users need to request a web based Subversion repository at the time of the repository creation as they are based in a different part of the filesystem on cvs.cs.unc.edu. Access to and permissions on web based repositories are managed by Computer Services. Therefore, requests for access changes should be directed to firstname.lastname@example.org.
If you wish to share your Subversion repository with non-department users, there are two options:
1) Buy them a Computer Science cvsonly account, which allows them SSH access only to the CVS server.
2) Request a web-based Subversion repository at the beginning. External users can then be added without a need for an account.