Tuesday, August 22, 2006

How to use CVS from the Command Line in Windows

I was given CVS access to pear, and had been using TortoiseCVS for long enough to think I was comfortable with it.

Sadly, I wasn't. I was ALSO too embarrassed to ask for help. I mean, shouldn't the mystery of CVS be instantly obvious? TortoiseCVS just had me plain confused.

So; in 27 or less easy steps, here's the best way to use CVS. On Windows.

  1. Download CVS. Try the latest stable version of CVS for windows.
  2. Unzip the archive, which just contains cvs.exe. Put it in your path, somewhere. For instance, c:\windows\ is an ideal place.
  3. Start Menu
  4. Run
  5. Type 'cmd'
  6. This is the command line. How scary. All Black and White and blinking at you.
  7. Type 'cvs'. If you've screwed up step #2, you'll get a file not found error. Go back and try again.
  8. The next thing we want to do is find a CVS server, and login to it. We'll try the PHP one. Type: cvs -d :pserver:cvsread@cvs.php.net:/repository login - if you haven't figured it out, cvsread is your username, and cvs.php.net is the server. The pserver bit is just the method you intend to use to login with. phpfi is the password.
  9. Alrighty: time for our first checkout. Type: cd \, mkdir pear-cvs, cd pear-cvs, cvs -d :pserver:cvsread@cvs.php.net:/repository checkout pear
Voila! Checked out. Trundle off and make changes as you please. Now, cvsread is the PHP anon. checkout account - you can't commit back changes. But, if you could... well, updating via the command line without setting your CVSROOT environment varible is a PITA. Now I'd use tortoise CVS to handle the updating and the committing.


Anonymous said...

You are awesome. After battling different gui clients, when all I wanted was a quick one-shot checkout, your post got me sorted right out of the gate. Thanks for this!

Anonymous said...

Thanks! It is really helpful.

Walter said...


Just what I want!, no installers, no GUI.

dragon said...

Very nice thank you mate

Srikanth Nandi said...

How to do the CVS checkout automatically as daily task.
DO we have any option to create a batch file which includes cvs command to auto checkout daily for latest artifacts

MandarP said...
This comment has been removed by the author.
MandarP said...

Hi, I am very new in this version control world. But I want to maintain versions of my java classes and jsp pages. so is this CVS a right option? If yes then please tell me how to start for it.

Unix and linux forum said...

Thanks for writing this article. I have written a similar post on using cvs command in unix

I hope it will be helpful.