Printable Version of this PageHome PageRecent ChangesSearchSign In

Creating a CVS repository for personal use

A few people have found the CVS Instructions that I put up for my machine learning group members and asked me how I set up the repository in the first place. (Those instructions describe how to access the repository, not how I created it.)

Here, I'll describe how you can go about creating a CVS repository on the CoC systems. I'll assume that you already know what CVS is and why you want to use it. If that's not you, I'd recommend you look at this CVS tutorial or, better yet, at Subversion (SVN) (I prefer Subversion to CVS for various reasons).

Create a CVS repository

The first thing you'll need to do is to decide where you want to keep the repository. Remember, the repository is where CVS will keep all of its scratch files and revision information. Normally, this would go some place like /var/lib/cvsroot, but on the CoC systems, you probably don't have access to /var/lib (and if you do, worry ;-) ). I'll use ~/cvsroot as my cvsroot. This is a good place because CNS will backup all the files in your home directory nightly, so you won't need to worry as much about, say, your dissertation being lost to a bad sector or fluke nuclear blast. From your home directory, create the cvsroot directory and set its permissions:

$ mkdir cvsroot
$ chmod 700 cvsroot


Next, we'll need to tell CVS where this repository will be. We do this with the CVSROOT environment variable. I'll assume that you are using a bourne-like shell (I use bash); if you use another shell, the syntax to set environment variables may be slightly different. The CVSROOT variable should point to the directory we just created:

$ export CVSROOT=/net/hc283/eaganj/cvsroot


In my case, my home directory is in /net/hc283/eaganj. To find out where yours is, type pwd from your home directory.

We now need to tell CVS that it should initialize the CVSROOT directory with its bookkeeping files that it will use to keep track of your repository. We do this with the cvs init command:

$ cvs init


Congratulations! You now have an empty CVS repository. Let's take a look inside:

$ ls -l cvsroot
total 1.0k
drwxrwxr-x    3 eaganj   stud         1.0k Sep  1 18:33 CVSROOT/


You'll see that CVS has created a directory CVSROOT. This is where CVS keeps its bookkeeping information about the data in your repository (which is currently empty). Let's make sure that no one else can read our data:

$ chmod 700 cvsroot/CVSROOT


Create your new project

Let's now create a new project to put into the repository (if you already have an existing project that you want to put under CVS-control, skip this step and go right ahead to importing the project). I'm going to call our new project beaker. You'll probably want to use a different name. I'm going to put it into the directory ~/tmp/beaker. You can put it anywhere you want. This will be your working copy of the data in the project.

$ mkdir tmp/beaker
$ cd tmp/beaker


Let's create some data for the project:

$ touch beaker.tex
$ echo "print 'hello world'" > beaker.py
$ echo "Project Beaker by me" > README


We now have a (fairly pointless) project. You will probably have something more meaningful to put into the repository.

Importing your project into CVS

Let's go ahead an import our project into CVS. First, make sure that we're in the directory we want to add to the repository (in my case, ~/tmp/beaker). Now we tell CVS to import that project:
$ cvs import beaker foo initial


The above command creates a new project called beaker that will contain all the files in the current directory. The last two parameters are the vendor tag and the release tag. The vendor tag can be whatever you want, and the release tag is a name by which you can refer to this set of files and versions that you've imported. Unless you know what these mean, they don't matter; just put something there.

CVS will now ask you to create a log file for the transaction you're about to make. Put whatever you want in; I'll use "Initial import into CVS."

There you go! You now have a CVS repository containing your project. Beware that the cvs import command does not modify your local copy of the project – it only modifies the repository. That means that you don't have a working copy of your project checked out from CVS, so you'll want to change to another directory and now checkout a fresh copy of your project so that you can begin working with CVS. These CVS Instructions might be useful.

Last modified 2 September 2004 at 2:41 pm by eaganj