Simply Getting Started With A CVS Repository

So, you're trying to set up a CVS repository and it seems a bit confusing, even with Cederqvist in front of you? Well, here's a simple list of steps that generally does the trick if you're not being, well, tricky.

Before we start, let's mention that this is all done local to the repository machine. You can do some of the steps remotely, but that's a little more complicated, and this is a simple guide. Also, this is for a multi-user setup, not just for you; if you're setting up CVS just for you, you can follow these steps, but you'll be doing a little more than is absolutely required.

Notation about examples:
Values given in italics are example values only; replace them with something more appropriate to your actual situation.

    The Steps:
  1. Decide on a location for your repository. This is where CVS will put your data when it's "checked in". You shouldn't have to look in this directory once it's all created, although once you learn a bit more about CVS, the ability to poke around here is a plus. Let's say you're going to use /data/cvsroot.
  2. Set the CVSROOT environment variable to this value. I use tcsh, so I generally type something like setenv CVSROOT /data/cvsroot. Bourne shell and derivates would use something like CVSROOT=/data/cvsroot; export CVSROOT.
  3. Create the directory: sudo mkdir $CVSROOT
  4. Decide on a group to provide access to your repository. Let's say we choose "cvsusers".
  5. Fix up the ownership on the repository: sudo chgrp cvsusers $CVSROOT ...and then the permissions: sudo chmod g+rwxs $CVSROOT.
  6. Initialize the repository: cvs init
  7. Verify that the repository is valid:
     cd /tmp
     mkdir FOO
     cd FOO
     cvs checkout CVSROOT
    If you check out the administrative module, you're cool.

So you now have a working repository. It's not all that useful until you get a module of your own in there. Do not ... let me emphasize that: DO NOT use the administrative ("CVSROOT") module for development work.

There are ways to create module: you can create an empty module and fill it in, or you can import an existing codebase. Let's assume you're going to start with an empty module, since it's good practice to start your projects under some sort of version control from the very beginning. You can create an empty module by running "cvs import" in an empty directory.

Let's say that you're going to call your module coolstuff.

  cd /tmp
  mkdir BAR
  cd BAR
  cvs import coolstuff $USER start
...provide the appropriate log information, and you're set. Check out your new module with cvs checkout coolstuff and CVS will create a directory named coolstuff in the current working directory. Add files with cvs add filename, followed by a cvs commit filename to push the file to the repository. Directories are added with cvs add directoryname and are created on the repository immediately.

$Id: getting_started.html,v 1.2 2005/09/25 22:41:43 stremler Exp $