CVS: Create a Repository

Posted September 4, 2005 by wolf359 in UNIX software

CVS (Concurrent Version System) is an essential tool for system administrators, programmers, authors, or anyone else who has to maintain a collection of text files that change over time. CVS is a version control system that keeps track of changes to sets of files. It all starts with a repository, and this is how to make one.

Assuming that CVS is installed and working on your system, the simplest way to make a repository is to create a directory and issue the cvs init command:

mkdir /export/cvsroot
cvs -d /export/cvsroot init

In the cvs…init command, the directory (-d option) must use the absolute path of the directory, not a relative path from the current working directory.

To make your CVS installation more secure and easier for use by multiple users, create a system user and group. (You can use cvs for both.) The user and group will own the cvsroot directory and all files under it. Users authorized to make changes to the files in the repository can be assigned to this group. Changing the SGID (set group id) bit on the directory will ensure that new files created in the directory will retain the group setting of the directory. Assuming that you have created a user cvs and group cvs, these commands will make a more secure CVS repository:

mkdir /var/cvsroot
chown cvs:cvs /var/cvsroot
chmod g+rwxs /var/cvsroot
cvs -d /var/cvsroot init

The Conversation

Follow the reactions below and share your own thoughts.