CVS: set CVSROOT environment variable

Contributor Icon Contributed by wolf359 Date Icon September 4, 2005  
Tag Icon Tagged: UNIX software

This is a simple tip that will save tons of time when working with CVS. Since multiple CVS repositories can exist on the same system, CVS needs to know which one you want to use when you run the cvs program.


When running the cvs command, either the -d option must be used with the absolute path of the CVS repository (like /export/home/longname/programming/cvsroot) or the CVSROOT environment variable must be set with this value. Typing the cvsroot gets old quickly, so you’ll find that adding this variable to your environment will make your life happier.

Assuming you are running a Bourne-type shell (sh, ksh, bash, zsh…) you can set this variable temporarily by running

CVSROOT=/export/home/longname/progrmaming/cvsroot
export CVSROOT

(note, you can condense this to one command in most shells other than sh with export CVSROOT=/path/to/cvsroot)

Making this setting persistent is much more preferrable. Edit your .profile with your favorite editor (if it isn’t vi, then just suck it up and learn it.. you’ll love it (eventually!)) and add the line or lines above. Once you have edited, it will take effect the next time you create a shell or when you source the file into the current shell as with

. ./.profile

Previous recipe | Next recipe |
 
blog comments powered by Disqus