CVS User Manual

Source: Internet
Author: User
Tags bug tracking system file diff ssh port ssh server

Copyright statement: You can reprint it at will. Please mark it as a hyperlink during reprinting.ArticleSource and author information and this statement


Keywords: CVs Cvsweb cvstrac wincvs cvsroot


CVS is a C/S system. Multiple developers use a central version control system to record file versions to ensure file synchronization. The working mode is as follows:

CVS server (file version Library)/| \ (this is the same step)/| \ developer 1 developer 2 Developer 3

As a general developer, you can select, And the CVS administrator needs to understand more. Finally, we also briefly introduce the use of CVS clients in windows, selection of remote user authentication for CVs and integration with development environments such as bug tracking systems.

    1. Initialize the CVS environment: Set up the administrator of the CVS Environment
    2. Routine Use of CVS: the most commonly used CVS command in daily development, developer Administrator
    3. Branch development of CVS: The project is administrator Based on Different progress and target concurrency
    4. CVS user authentication: Remote User Authentication through SSH, secure, simple Administrator
    5. Cvsweb: CVS Web access interface greatly improvedCodeVersion comparison Efficiency Administrator
    6. CVS Tag: Set $ID$ Add code comments to help developers track the development process
    7. CVS vs VSS: Comparison between CVs and virsual sourcesafe, developer Administrator
    8. Wincvs: Set wincvs Authentication through SSH
    9. Build a group development environment based on cvstrac: Implement CVS user management on the web interface through cvstrac, and integrate BUG Tracking and Wiki Communication
    10. User permission management in CVS: system user-based CVS permission management and cvsroot/passwd-based virtual user management

20% of a system's functions often meet 80% of the requirements, and CVS is no exception. The following are the most common features of CVs, and may not reach 20% of all its command options, as a general developer, it is enough to use CVS update and CVS commit at ordinary times. More requirements will naturally appear in the actual application process. Looking back at relevant documents from time to time, there are often unexpected gains.

CVS environment Initialization

Environment setting: Specifies the path of the CVS library cvsroot


Setenv cvsroot/path/to/cvsroot


Cvsroot =/path/to/cvsroot; export cvsroot

The remote CVS server settings are also described below:

Cvsroot =: ext: $ USER@test.server.address # port:/path/to/cvsroot cvs_rsh = SSH; export cvsroot cvs_rsh

Initialization: the initialization of the CVS version library.

CVS init

First import of a project

CVS import-M "write some comments here" project_name vendor_tag release_tag

After execution: all source files and directories will be imported to the/path/to/cvsroot/project_name directory.

Vender_tag: developer tag

Release_tag: Version release tag

Export Project: Export Code from the CVS Library

CVS checkout project_name

CVs will create the project_name directory andSource codeExport to the corresponding directory. Check out in this checkout and virvual sourcesafe is not a concept. The check out in virvual sourcesafe is CVS update and check in is CVS commit.

Routine Use of CVS

Note: after the first export, instead of Synchronizing files through CVS checkout, you need to go to the project_name directory exported by CVS checkout project_name for version synchronization of specific files (ADD, modify, delete) operation.

Synchronize files to the latest version

CVS update

If no file name is specified, CVs will synchronize the files in all subdirectories. You can also specify a file name/directory for synchronization.

CVS update file_name

It is recommended that you do this once a day before starting work or importing your work to the CVS repository, and develop the habit of "Synchronize and modify", which is different from virvual sourcesafe, CVS does not have the concept of File Locking. All conflicts are resolved before commit. If someone else modifies them and commit them to the CVS database, CVs will notify you of file conflicts and automatically use


Content on CVS server


Content in your file


Mark the conflict content.

Version conflicts are generally caused by modifying one file by multiple people, but such project management problems should not be solved by CVS.

Confirm to write the modification to the CVS Library

CVS commit-M "write some comments here" file_name

Note: many actions of CVs are confirmed and modified through CVS commit. It is best to modify only one file at a time. Before confirming the modification, you also need to enter the modification notes to help other developers understand the reasons for the modification. If you directly confirm 'cvs commit file_name 'without writing-M "Comments", CVs will automatically call the system's default text editor (usually VI) to write comments.

The quality of comments is very important: So not only do you have to write, but you also have to write something meaningful: to make it easier for other developers to understand.

It is difficult for other developers to quickly understand bad comments, such as-M "bug fixed" or-m ""

Good comments can even be used in Chinese:-M "added email address verification during user registration"

Modify a version comment: it is a good habit to confirm that only one file is sent to the CVS library at a time, but sometimes you forget to specify the file name and comment multiple files to the CVS library as well, the following command allows you to modify comments of a certain version of a file:

CVS admin-M 1.3: "write some comments here" file_name

Add File

After creating a new file, for example, touch new_file

CVS add new_file

Note: For images, Word documents, and other non-plain text items, use the CVS add-kb option to import files in binary format (k indicates the extension option, and B indicates the binary type ), otherwise, the file may be damaged.

For example:

CVS add-kb new_file.gif

CVS add-kb readme.doc

What if the keyword replacement attribute is set incorrectly during the first import?

CVS admin-KKV new_file.css

Then confirm the modification and comment out

CVS ci-M "write some comments here"

Delete an object

After a source file is physically deleted, for example, RM file_name

Cvs rm file_name

Then confirm the modification and comment out

CVS ci-M "write some comments here"

The method for merging the preceding two steps is as follows:

CVS Rm-F file_name

CVS ci-M "why delete file"

Note: Many CVS commands are abbreviated to commit => Ci; update => up; checkout => Co/get; remove => RM;

Add directory

CVS add dir_name

View modification history

CVS log file_name

CVS history file_name

View differences between different versions of the current file

CVS diff-r1.3-r1.5 file_name

View the differences between the current file (which may have been modified) and the corresponding file in the library

CVS diff file_name

The CVS Web interface provides a more convenient way to locate the differences between file modification and version comparison. For specific installation settings, see the Cvsweb usage later.

Correct Method to restore the old version through CVS:

If CVS Update-r1.2 file. Name is used

This command adds a stick tag to file. Name: "1.2", although you only want to restore it to version 1.2.

The correct method to restore the version is: CVs Update-p-r1.2 file_name> file_name

If you have accidentally added the stick tag, use CVS Update-a to solve the problem.

Rename a mobile file/File

CVS does not include CVS move or CVS rename, because these two operations can be implemented by first CVS remove old_file_name and then CVS add new_file_name.

Delete/move a directory

The most convenient method is to allow the Administrator to directly move and delete the corresponding directories in the cvsroot (because the subdirectories of a CVS project are independent, they can all be used as new independent projects under the $ cvsroot directory: similar to a tree, in fact, any shard can survive independently). After modifying the directory, ask its developers to re-export the project CVS checkout project_name or use CVS Update-DP for synchronization.

Project release export source files without the CVS directory

During development, you may notice that CVS creates a CVS/directory under each Development Directory. There are files used to record the corresponding information between the current directory and the CVS library. However, when a project is released, you generally do not want to include the file directory with the CVS directory containing CVS information. This one-time export process uses the CVS Export command, however, export can only be exported for one tag or date, for example:

CVS export-r release1 project_name

CVS export-D 20021023 project_name

CVS export-D now project_name

CVS branch: synchronous development of multiple branch projects

Confirm version milestones: multiple files have different version numbers. When a project reaches a certain stage, you can specify a milestone version number for all files to export the project according to the milestone version number, it is also the basis for the development of multiple branch projects.

CVS tag release_1_0

Start a new milestone:

CVS commit-R 2 mark all files and start development in 2.x

Note: The revsion in CVS does not have a direct relationship with the released version of the software package. However, it is easier to maintain the version of all files with the same version as the released version.

Build a version Branch

When the 2.x version of the Development Project is found to have a problem with 1.x, but 2.x does not dare to use it, export a branch release_1_0_patch from the milestone marked earlier: release_1_0

CVS rtag-B-r release_1_0 release_1_0_patch proj_dir

Some people first export the release_1_0_patch branch in another directory: solve the urgent problem in 1.0,

CVS checkout-r release_1_0_patch

Others are still developed on the main branch 2. x of the project.

Correct the error on release_1_0_patch and mark a 1.0 Error Correction version.

CVS tag release_1_0_patch_1

If 2.0 thinks that these errors are also required to be modified in 2.0, you can also merge the changes in release_1_0_patch_1 in the Development Directory of 2.0 to the current code:

CVS Update-J release_1_0_patch_1

Remote Authentication of CVS remote access to CVS through SSH

It is difficult to use pserver-based Remote Authentication in CVS. You need to define the server and user group, user name, and password,

Common login formats are as follows:

CVS-D: pserver: cvs_user_name@cvs.server.address:/path/to/cvsroot Login


CVS-D: pserver: Login

It is not safe, so it is generally used as an anonymous read-only CVS access method. In terms of security, it is better to pass the local account authentication and SSH transmission. You can set the content in the/etc/profile of the client:

Cvsroot =: ext: $ USER@cvs.server.address # port:/path/to/cvsroot cvs_rsh = SSH; export cvsroot cvs_rsh

All local users of all clients can map to corresponding accounts with the same name on the CVS server.

For example:

The CVS server is The cvsroot path above is/home/cvsroot, and the other development client is If Tom has an account of the same name on both machines, it is set from

Export cvsroot =: ext: tom@

Export cvs_rsh = SSH

Tom can directly access the cvsroot of on (if you have the permission)

CVS checkout project_name

CD project_name

CVS update


CVS commit

If the ssh port on the server where CVS is located is not the default 22, or is inconsistent with the default ssh port on the client and the CVS server, it is sometimes set:

: Ext: $ USER@test.server.address # port:/path/to/cvsroot

The error message is as follows:

SSH: Test. server. Address # port: Name or service not known

CVS [checkout aborted]: End of file from server (consult abve messages if any)

The solution is to make a script to specify port redirection (if alias is not available, the file cannot be found ):

Create a/usr/bin/ssh_cvs file. Assume that the ssh port of the remote server is not the default port: 34567.

#! /Bin/sh

/Usr/bin/ssh-P 34567 "$ @"

Then: chmod + x/usr/bin/ssh_cvs

And cvs_rsh = ssh_cvs; export cvs_rsh

Note: Port refers to the SSH port of the corresponding server, not the pserver port dedicated to CVS.

Cvsweb: Improves file browsing efficiency

Cvsweb is the CVS Web interface, which can be greatly improvedProgramStaff positioning modification efficiency:

The sample can be seen:

Download Cvsweb: Cvsweb has evolved from the original version into a richer multi-functional interface version. This is my personal feeling that the installation settings are more convenient:

Originally in:Http:// it has been deleted. You can still download Cvsweb from this site. In fact, the Cvsweb project of FreeBSD has developed better in the past two years, at the beginning, FreeBSD version was not used because there was no color file diff function.

Download and unpack:

Tar zxf Cvsweb. tgz

Put the configuration file Cvsweb. conf in a safe place (for example, in the same directory as Apache configuration ),

Modify: Cvsweb. cgi allows CGI to find the configuration file:

$ Config = $ ENV {'cvsweb _ config'} | '/path/to/Apache/CONF/Cvsweb. conf ';

Go to/path/to/Apache/conf and modify Cvsweb. conf:

    1. Modify the cvsroot path settings:

      % Cvsroot = (

      'Development' => '/path/to/cvsroot', # <= Modify the local cvsroot

    2. By default, deleted documents are not displayed:

      "Hideattic" => "1", # <= The deleted document is not displayed by default.
    3. You can also customize the description of the page header in the configuration file Cvsweb. conf. You can modify $ long_intro to the text you need.

Cvsweb cannot be opened to all users at will, so Web user authentication is required:

Mr. Cheng passwd:

/Path/to/Apache/bin/htpasswd-C Cvsweb. passwd user

Modify httpd. conf: add

<Directory "/path/to/Apache/cgi-bin/Cvsweb/">

Authname "CVS authorization"

Authtype basic

Authuserfile/path/to/Cvsweb. passwd

Require valid-user


CVS tags: $ ID: cvs_card.html, V 1.5 2003/03/09 08:41:46 chedong exp $

Adding $ ID: cvs_card.html, V 1.9 2003/11/09 07:57:11 chedong exp $ to the comments at the beginning of the program file is a good habit. CVs can automatically explain and update the content: file_name version time user_name format, such as: cvs_card.txt, v 1.1 2002/04/05 04:24:12 chedong exp. You can learn about the last modification and modification time of the file.

Several common default files: Default. php <? PHP/** copyright (c) 2002 company name. * $ header:/home/cvsroot/Tech/cvs_card.html, V 1.9 2003/11/09 07:57:11 chedong exp $ */?> ============================================ Default. java: note the differences between/** start javadoc comments and/** start comments for file headers/** copyright (c) 2002 mycompany name. * $ header:/home/cvsroot/Tech/cvs_card.html, V 1.9 2003/11/09 07:57:11 chedong exp $ */package COM. mycompany; import java .; /*** comments here */public class default {/*** comments here * @ Param * @ return */Public tostring () {}}==================================================== default. Pl :#! /Usr/bin/perl-W # copyright (c) 2002 company name. # $ header:/home/cvsroot/Tech/cvs_card.html, V 1.9 2003/11/09 07:57:11 chedong exp $ # file comments hereuse strict;

CVS does not have the file lock mode. vss simultaneously records the file to be locked by the Export owner while checking out.

CVS update and commit, VSS is get_lastest_version and check in

The CVS corresponding to the checkout/undo check out of VSS is edit and unedit.

In CVs, the automatic update function is enabled by default, which also brings about a potential problem, if you do not use the-kb method to add binary files, the files may become invalid when CVS is automatically updated.

$ Header:/home/cvsroot/Tech/cvs_card.html, V 1.5 2003/03/09 08:41:46 chedong exp $ Date: 2003/11/09 07:57:11 $ this mark is called keyword explaination in virsual sourcesafe, it is disabled by default. You need to enable it through opition and specify the file type for keyword scanning of the source file :*. TXT ,*. java ,*. HTML...

Tags common to both virsual sourcesafe and CVs are:

$ Header:/home/cvsroot/Tech/cvs_card.html, V 1.5 2003/03/09 08:41:46 chedong exp $

$ Author: chedong $

$ Date: 2003/11/09 07:57:11 $

$ Revision: 1.9 $

I suggest using common keywords whenever possible to ensure that code can be easily tracked in CVs and VSS.



CVS Windows Client: stable version 1.2


SSH Windows Client


After the above two software are installed:

Admin ==> preference settings of the wincvs Client

1. In the general menu

Set cvsroot: username@

Set authorization: Select SSH Server

2 Port

HOOK: Check for alternate RSH name

Set the ssh.exe path, which is installed in c: \ Program Files \ networksimplicity \ SSH \ ssh.exe by default.

Then you can use wincvs to perform the CVS operation. All operations will jump out of the command line window and require you to enter the authentication password on the server.

Of course, if you think this is annoying, another way is to generate a public/private key pair without a password, and set CVS to use SSH Authentication Based on the Public Key/private key (in the general menu ).

Optional diff tool: examdiff



In the wincvs menu admin ==> preference, choose wincvs.

Selected: externel diff Program

And set the diff tool path, such as: C: \ Program Files \ ed16i \ examdiff.exe

When diff is applied to a file, you need to select use externel diff in the lower right corner of the window for the first time.

Establish a group development environment based on cvstrac

As a group-level development environment, Version Control Systems and bug tracking systems all involve user authentication. It is very difficult to easily integrate these systems. After all, we cannot expect a version control/BUG Tracking integration system that is as highly integrated as source offsite in Linux.

I personally disagree with remote user authentication in pserver mode. However, if most of the team members use Windows clients for development, it is still difficult to avoid cvsroot/passwd authentication in general, however, the management of CVS users is troublesome. I was going to write a management interface using Perl myself until I found cvstrac: A web-based BUG Tracking System plug-in to the CVS system, this includes managing the cvsroot/passwd files on the web interface, and even integrating the wikiwiki discussion group function.

Here we will first talk about user authentication in the pserver mode of CVS. The user authentication service of CVS is based on inetd:

Cvspserver stream tcp Nowait Apache/usr/bin/CVS CVs -- allow-root =/home/cvsroot pserver

It is generally on port 2401 (this port number is very memorable: the square of 49)

The CVS user database is based on the cvsroot/passwd file. The file format is as follows:

[Username]: [crypt_password]: [mapping_system_user]

Since the passwords are all encrypted using the UNIX standard crypt, the format of this passwd file is basically an extension of the Apache htpasswd format (one more system user ing field than the Apache passwd file ), therefore, this file can be used in the simplest way.

Apache/bin/htpasswd-B myname mypassword

Create. Note: The file created by using htpasswd does not have a field mapped to the System user.

For example:

New: gebvosup/zkl2

Setup: aisqunaaoy3qw

Test: hwepz/BX. redu

The purpose of the ing system user is: you can create a dedicated CVS service account, such as using Apache to run the user Apache, and grant all permissions under the/home/cvsroot directory to this user, create different development user accounts in the passwd file, but the final file read and write permissions of the development user account are mapped to Apache users, in SSH mode, multiple system developers must be in the same group to read and write files in the CVS library to each other.

Further, You can map users to the Apache system users.

New: gebvosup/zkl2: Apache

Setup: aisqunaaoy3qw: Apache

Test: hwepz/BX. redu: Apache

Cvstrac solves the problem of managing cvsroot/passwd. It also includes a bug tracking report system and integrated wikiwiki communication functions. It is installed using CGI and based on GNU Public License:

Add the cvspserver service to inetd:

Cvspserver stream tcp Nowait Apache/usr/bin/CVS CVs -- allow-root =/home/cvsroot pserver

Xietd configuration file: % cat cvspserver

Service cvspserver


Disable = No

Socket_type = stream

Wait = No

User = Apache

Server =/usr/bin/CVS

Server_args =-f -- allow-root =/home/cvsroot pserver

Log_on_failure + = userid


Note: The purpose of setting this parameter to Apache is to be consistent with that of all users in/home/cvsroot, this user must initialize the myproj generated by cvsroot/passwd and cvstrac under/home/cvsroot. DB has read permission.

Installation Process

  1. Download: Download from

    I am using an application package that has been compiled on Linux: cvstrac-1.1.2.bin.gz,

    % Gzip-D cvstrac-1.1.2.bin.gz

    % Chmod + x cvstrac-1.1.2.bin

    # Music cvstarc-1.1.1.bin/usr/bin/cvstrac

    For source code compilation:

    Download the SQLite RPM package from the

    Rpm-I sqlite-devel-2.8.6-1.i386.rpm

    Download package from

    Unpackage, assuming unpackage to/home/chedong/cvstrac-1.1.2, and planning to install cvstrac under/usr/local/bin directory, CD/home/chedong/cvstrac-1.1.2 edit


    Srcdir =/home/chedong/cvstrac-1.1.2

    Installdir =/usr/local/bin


    Music makefile


    # Make install

  2. Initialize the cvstrac database. Assume that the database name is myproj.

    On the installed CVS server (the CVS library should have been initialized at this time, for example, the CVS init is initialized in/home/cvsroot), run it.

    % Cvstrac init/home/cvsroot myproj

    After running, there will be a myproj in/home/cvsroot. database, using the cvstrac service,/home/cvsroot/myproj. DB/home/cvsroot/readers/home/cvsroot/writers/home/cvsroot/passwd files should be writable for running Web Services, on redhat8, there is an Apache user and an Apache Group by default, so in httpd. the conf file sets the Apache user to run the Web Service:

    User Apache

    Group Apache,

    Set the user to be in the Apache user group and the Apache Group.

    # Chown-r Apache: Apache/home/cvsroot

    -RW-r -- 1 Apache 55296 Jan 5 myproj. DB

    Drwxrwxr-x 3 Apache 4096 Oct 24 cvsroot/

    Drwxrwxr-x 2 Apache 4096 Aug 30 some_proj/

    In addition, you have set the following parameters in/home/cvsroot:

    Chmod 664 readers writers passwd
  3. Create the script cvstrac in the Apche/cgi-bin directory:

    #! /Bin/sh

    /Usr/bin/cvstrac cgi/home/cvsroot

    Set the script to execute:

    Chmod + x/home/Apache/cgi-bin/cvstrac
  4. Entering the management interface from http://cvs.server.address/cgi-bin/cvstrac/myproj

    Default Login Name: Setup password setup

    For general users:

  5. After you reset the cvsroot path in setup,/home/cvsroot

    If the file is used for the first time, you need to create the passwd, readers, and writers files under/home/cvsroot.

    Touch passwd readers writers

    Then set the user that belongs to Apache,

    Chown Apache. Apache passwd readers writers

    After the setup user is used to create a new user, the account under cvsroot/passwd will be updated synchronously.

Change the logon password and report bugs,

You can learn more about the usage details.

For the wincvs mentioned above, set in perference:

Cvsroot field input: username@ip.address.of.cvs:/home/cvsroot

Authenitication: Use passwd file on server side

You can perform the CVS operation on the server.

CVS user permission management

CVS has two permission management policies:

    • System User Management Based on System File Permissions: Suitable for development by multiple developers who use system accounts on Linux.
    • Virtual user management based on cvsroot/passwd: Suitable for multiple developers on Windows platforms to map accounts to system accounts.

Why are Apache/Apache users used? First, redhat8 is available by default, and this user can easily perform Web management through cvstrac.

Chown-r Apache. Apache/home/cvsroot

Chmod 775/home/cvsroot

Multiple developers who connect to the CVS server through SSH on Linux: Share and read files through the Apache Group

Developers have a system account on the Development Server: sysuser1 sysuser2, which makes them all belong to the Apache Group, because all newly imported projects through CVs are open to the group: 664 permissions, in this way, no matter the project file imported by the System user, as long as the file group host is Apache, all other system development users in the same group can read and write data. The same is true for ssh-based Remote Authentication.

Apache (system group)

/| \

Sysuser1 sysuser2 sysuser3

Multiple developers connecting to the CVS server through cvspserver on Windows: Through ing the passwd file to Apache users, the files can be shared and read and written.

Their accounts are managed through files such as cvsroot/passwd and readers writers, and all virtual users are mapped to Apache users through cvstrac.

Apache (system user)

/| \

Windev1 windev2 windev3

CVS + (wincvs/Cvsweb/cvstrac) is used to form a relatively complete cross-platform workgroup development version control environment.

Related Resources:

CVS home:


Cvs faq:

Http:// /~ Molli/cvs-index.html

Related Websites:


CVS-parallel version System


CVS free book:


Quick query card of CVS command:




Cvstrac: A web-based bug and patch-Set Tracking System for CVS


Statcvs: Code statistics Tool Based on CVs: by the amount of code, by the developer's statistical table, etc.


How to plan CVS in Web development: Check "CVS Web Development" on Google"


Some ide environments integrated with CVS:


Magic C ++

<A href = ""> </a>


<Return to home page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.