Local Subversion Repositories

This post originally appeared on the Software Carpentry website.

A colleague in the UK who is going to teach Software Carpentry asked about setting up repositories. In particular, he doesn't have a server where he can create accounts and repos, so he was thinking of using Git or Mercurial, and having students host their repos on their own machines. That's not actually necessary: if you're going the locally-hosted route, and giving each student a separate repository, you can still use Subversion: just use the "file:" protocol for connecting instead of "http:" or "svn+ssh:". For example:

$ pwd
/users/gvw
$ mkdir demo
$ cd demo
$ svnadmin create jon
$ svn checkout file:///users/gvw/demo/jon mycopy
$ ls
jon   mycopy
$ cd mycopy
$ touch example.txt
$ svn add example.txt
A     example.txt
$ svn commit -m "Checking in an example file"
Adding         example.txt
Transmitting file data .
Committed revision 1.

The repository can be anywhere on the local file system—I just put it and the working copy in the same directory so that they'd be easy to delete afterward. And a repository that you're accessing via the "file:" protocol can also be accessed through other protocols—SVN does a good job of separating protocol from storage. The only thing I trip over when I'm doing this is the triple slash: the protocol spec is "file://" (two slashes) and then there's the absolute path to the repo (which starts with another slash) making for three in all.

Dialogue & Discussion

Comments must follow our Code of Conduct.

Edit this page on Github