CVS Quickstart Guide

The Concurrent Versions System (CVS) is an open source tool that lets you manage versions of anything stored in files. If you’re a software developer trying to manage different versions of the same code, you’ll want to check out this three-part series. It is excerpted from chapter two of Essential CVS, Second Edition, written by Jennifer Vesperman (O’Reilly; ISBN: 0596527039). Copyright © 2007 O’Reilly Media, Inc. All rights reserved. Used with permission from the publisher. Available from booksellers or direct from O’Reilly Media.

To help you get up to speed quickly using CVS, this chapter explains the most common CVS operations. The commands and examples in this chapter are based on standard situations and cover only the most common options. Future chapters go into more depth on each topic covered in this chapter.

Most of the examples and instructions in this chapter are based on the Unix/Linux command-line CVS client, though I also provide examples using multiplatform clients. Most graphical clients use the CVS command names for their menu options and buttons, so if you’re using a graphical client other than one of the ones I provide examples for, you should be able to follow this chapter reasonably easily. Those using Mac OS X can use CVS from the command line, and people using Windows who want to use the command line can use Cygwin (available from http://www. CVS is available via the Cygwin installer. Graphical clients and clients for operating systems other than Unix/Linux are described in Appendix A.

You may not need to read all of this chapter:

  1. If CVS is installed, and you’re working on an existing project that is already stored in CVS, skip the early sections and start at “Checking Out Files.” You may need your system administrator (or the person who installed your repository and existing project) to tell you the repository path and project name.
  2. If CVS is already installed and running, with a repository available for your project, go straight to “Importing Projects.” You may need your system administrator to tell you the repository path.
  3. If CVS is installed but there is no repository, go to “Building Your First Repository.”
  4. For information on installing graphic clients, see Appendix A.

If you’re not sure whether CVS is already installed and running, read the first part of “Installing CVS,” which tells you how to check. If you’re uncertain about having a repository, try searching for the directory CVSROOT. The repository root is the first directory in the repository and is the directory that contains CVSROOT. The repository path is the full pathname of the repository root, along with any remote access information needed; see “Accessing Remote Repositories” later in this chapter. The directories in the repository root, other than CVSROOT, are CVS projects.

{mospagebreak title=Installing CVS}

CVS is client/server software that runs on Unix and Linux platforms, including Mac OS X. The CVSNT program is a CVS-like server that runs on Windows, and there are CVS clients for Windows, Mac (including pre-OS X Macintosh), Linux, and Unix. When you install CVS on a Unix/Linux server, you automatically get both server and client software. To access CVS across the network from any Unix/Linux machine, install CVS on the machine in question. The server and (command-line) client software are one and the same.

CVS is available from It is also available as an installation package with many GNU/Linux distributions, including Debian, Red Hat, and SUSE.

A Windows-compatible CVS server is available at This server is not identical to the Unix server, but the differences are clearly listed in the CVS NT FAQ, and an installation guide is available on its web site.

Is CVS Installed?

If you are running Mac OS X, Cygwin, Unix, or Linux, you may already have CVS installed. If it’s installed and in your path, typing cvs at the command line produces the results shown in Example 2-1.

Example 2-1. CVS help display

$ cvs
Usage: cvs [cvs-options] command [command-options-and-arguments]
 where cvs-options are -q, -n, etc.
  (specify –help-options for a list of options)
 where command is add, admin, etc.
  (specify –help-commands for a list of commands
   or –help-synonyms for a list of command synonyms)
where command-options-and-arguments depend on the specific command
  (specify -H followed by a command name for command-specific help)
 Specify –help to receive this message

The Concurrent Versions System (CVS) is a tool for version control.
For CVS updates and additional information, see
the CVS home page at or
Pascal Molli’s CVS site at

If you already have CVS installed, you can skip this section and jump ahead to “Building Your First Repository.”

Graphic User Interfaces

If you prefer GUI clients, I recommend a visit to There you’ll find gCVS, WinCVS, and MacCVS, which are GUI clients for Unix and GNU/Linux, Windows, and Macintosh (pre-OS X), respectively.

If you are a Macintosh user running OS X, you can use the command-line version of CVS that comes with Mac OS X and can be downloaded from, or you can install the latest version of the standard Unix CVS server and client. To get a shell prompt in Mac OS X, open the Terminal application (which is located in /Applications/Utilities).

To compile and install the latest version of CVS, you need the free Xcode install ( for Mac OS X, which includes the GNU C compiler and other tools needed to compile source code.

A list of additional GUI clients is available in the CVS Wiki (

Secure Shell

If you plan to use CVS over a network, I recommend using the Secure Shell (SSH) protocol to establish secure connections between clients and server. You must install compatible versions of SSH on your client and server machines. For clients, you may need to find a version of SSH that can be used from the command line. See “Accessing Remote Repositories” later in this chapter for more information on this topic.

The OpenSSH web site ( is a good starting point for information on SSH and SSH clients. You may also want to read SSH, The Secure Shell: The Definitive Guide, by Daniel J. Barrett et al. (O’Reilly). For more than you ever wanted to know about SSH, see the FAQ at The Google list of SSH documentation is at Protocols/SSH/Documentation/.

Most Unix and Linux systems have an SSH client installed as part of the standard set of programs. Mac OS X also comes with an SSH client preinstalled. If it is not installed automatically, an SSH client is usually available in your distribution as an optional program.

The web site for MacCVS has a useful article on SSH for pre-OS X Macintosh users at ssh-classic.html. The instructions are useful regardless of which Macintosh CVS client you use.

To find an SSH client for Windows, start from the OpenSSH web site on Windows clients (

Once you have installed SSH on both the server and the client computers, generate keys for the clients and add their public keys to the server. This step lets your users run CVS without needing to give their password for every command.

{mospagebreak title=Installing CVS with a Package Manager}

The easiest way to install CVS under GNU/Linux is with a package manager such as YaST, GnoRPM, Kpackage, or Synaptic. In all of the package managers that I’m familiar with, the package name is either cvs or cvs followed by some punctuation and a version number. Figures 2-1 and 2-2 are screenshots of the installation with package managers, and show which menu CVS can be found in. Find and select CVS, and then click on the Install or OK button, as appropriate.

Figure 2-1.  CVS installation with Synaptic

Figure 2-2.  CVS installation with Fedora

The second easiest way to install CVS on GNU/Linux is using a command-line package manager. If you’re using apt (Debian, Ubuntu, and Mac OS X users who are running Fink), log in as root and use the command apt-get install cvs. apt will find the most recent version in its sources list. If using yum, the command is yum install cvs. Examples 2-2 and 2-3 show an apt and a yum installation.

Example 2-2. CVS installation with apt

root@pharaoh:/home# apt-get install cvs Reading package lists… Done
Building dependency tree… Done
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 30 not upgraded.
Need to get 1441kB of archives.
After unpacking 3088kB of additional disk space will be used.
Get:1 breezy/main cvs 1:1.12.9-13ubuntu1 [1441kB] Fetched 1441kB in 0s (2519kB/s)

Preconfiguring packages .. .
Selecting previously deselected package cvs. (Reading database … 64166 files and directories currently installed.)
Unpacking cvs (from …/cvs_1%3a1.12.9-13ubuntu1_i386.deb) …
Setting up cvs (1.12.9-13ubuntu1) …

Example 2-3. CVS installation with yum

[root@localhost ~]# yum install cvs Loading "installonlyn" plugin
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
–> Populating transaction set with selected packages. Please wait.
—> Downloading header for cvs to pack into transaction set.
cvs-1.11.21-3.2.i386.rpm 100% |=========================| 18 kB
—> Package cvs.i386 0:1.11.21-3.2 set to be updated
–> Running transaction check

Dependencies Resolved













732 k

Transaction Summary

Install      1 Package(s)
Update       0 Package(s)
Remove       0 Package(s)
Total download size: 732 k
Is this ok [y/N]: y
Downloading Packages:
(1/1): cvs-1.11.21-3.2.i3 100% |=========================| 732 kB
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: cvs ######################### [1/1]

Installed: cvs.i386 0:1.11.21-3.2

{mospagebreak title=Installing and Building CVS from Source}

Download the compressed .tar file from Decompress and unarchive the file. If you intend to keep the source after you compile it, unzip the compressed .tar file into /usr/src/cvs. Otherwise, you can decompress and unarchive it into /tmp. Next, cd into the cvs directory, read the INSTALL and README files, and run the commands there. I recommend that novice users disable automake and autoconf. (In CVS 1.12.1 and later, autoconf and automake are disabled by default.)

You should compile CVS as a user without superuser privileges (for security), but you must have superuser privileges when installing CVS (running make install) for everyone to use. If you are installing it into your own home directory for your personal use, you don’t need superuser privileges, but your choice of remote connection methods is limited.

Example 2-4 shows a sample installation from source. In this example, I decompress and unarchive the .tar file into /tmp and change directory into the top level of the resulting source tree. As I’m using a later version than 1.12.1, I don’t need to disable automake and autoconf. The next steps described in INSTALL for CVS 1.12.9 are to run the configure script provided and then, if that exits successfully, run make, switch to the root user, and run make install.

Example 2-4. Installing from source

$ ls
$ bunzip2 cvs-1.12.9.tar.bz2
$ tar -xpf cvs-1.12.9.tar
$ cd cvs-1.12.9
$ ./configure
checking for a BSD-compatible install… /usr/bin/install -c
checking whether build environment is sane… yes
config.status: executing depfiles commands config.status: executing default-1 commands $ make
make all-recursive
make[1]: Entering directory `/tmp/cvs-1.12.9′
make[2]: Entering directory `/tmp/cvs-1.12.9′
make[2]: Nothing to be done for `all-am’. make[2]: Leaving directory `/tmp/cvs-1.12.9′ make[1]: Leaving directory `/tmp/cvs-1.12.9′

$ su – root
$ make install
Making install in lib
make[1]: Entering directory `/tmp/cvs-1.12.9/lib’
make install-am
make[2]: Nothing to be done for `install-data-am’.
make[2]: Leaving directory `/tmp/cvs-1.12.9′ make[1]: Leaving directory `/tmp/cvs-1.12.9′

Please check back next week for the continuation of this article.

[gp-comments width="770" linklove="off" ]

chat sex hikayeleri Ensest hikaye