Public Subversion

From CSEE Documentation
Revision as of 15:58, 8 January 2009 by Willm1 (talk | contribs)

CS systems have the Subversion versioning system (similar to CVS) installed on them in /usr/bin/svn. Private SVN repositories are creatable by means described in the SVN book, but a method is also provided to create repositories that are publicly accessible over HTTP.

To share a repository in this way, first create it in a directory of your choosing.

willm1@linuxserver1:~$ mkdir svn
willm1@linuxserver1:~$ cd svn
willm1@linuxserver1:~/svn$ svnadmin create myrepo

This will create a directory myrepo/, and contents in that directory. This is a fully functional SVN repository:

willm1@linuxserver1:~/svn$ svn checkout file:///home/csee1/willm1/svn/myrepo ~/myrepo
Checked out revision 0.
willm1@linuxserver1:~/svn$ cd ~/myrepo
willm1@linuxserver1:~/myrepo$ echo 'Hello, World!' > greeting
willm1@linuxserver1:~/myrepo$ svn add greeting
A         greeting
willm1@linuxserver1:~/myrepo$ svn commit --message "Add a friendly greeting"
Adding         greeting
Transmitting file data .
Committed revision 1.

However, this is not yet accessible over the web; even if you put the repository in your web directory, browsing to this directory over HTTP will show the file contents of the SVN repository (README.txt, conf/, etc.), rather than the SVN contents. To make this happen, the web server needs to be informed that the myrepo directory contains SVN information, and SVN should be used to determine what is actually shown over the web. There is a web interface at my.cs.umbc.edu that can be used to accomplish this. Go there, and log in using your UMBC username and password as normal. Under "CSEE Account", click on "Subversion". You should see a menu like this: File:Svn-repo.png

In the box on the left, fill in the name that will be visible over HTTP. For example, myrepo would be a good choice for this repository, but if something more descriptive applies to your code you may choose whatever you like. In the box on the right, fill in the path to your repository, excluding the part which is your home directory. For example, the full path to the repository I created is /home/csee1/willm1/svn/myrepo, and my home directory is /home/csee1/willm1, so I would enter svn/myrepo in the box. Finally, click "Add" to make the changes take effect. Your repository will be exposed immediately, and the interface will look like this: File:Svn-repo-created.png

You can click on the link under "URL" to take you directly to the repository. Congratulations, your repository is completely set up!

If you are using the directory-listing feature of Apache to generate an index.html file for your CS account webpage, do not create a directory with the same name as the name you gave your repository, so that the repository shows up in that list. This will prevent others from checking out your repository properly using an svn client. It will still be accessible over the web, but error messages like the following will be generated:

willm1@chasca:/tmp$ svn checkout http://www.csee.umbc.edu/~willm1/myrepo/
svn: PROPFIND request failed on '/~willm1/myrepo'
svn: PROPFIND of '/~willm1/myrepo': 301 Moved Permanently (http://www.csee.umbc.edu)

It is recommended, instead, to create an HTML page that lists the things available on your web site.

Debugging

You may need to make sure that this directory is readable by the webserver. The web server currently runs with group id 48 (apache), so if you don't wish to give "o+rx" permissions on this directory you may use

chgrp -R apache ~/svn
chmod -R g+rx ~/svn

Otherwise, a simpler set of permissions can be given:

chmod -R o+rx ~/svn

Depending on your configuration, this step may not be necessary. If you run into a problem with this and are unable to make your repository visible, please submit a ticket detailing the problem via the my.cs.umbc.edu interface.