Thursday, October 11, 2012

CVS check out on UNIX with ssh

This article describes scenario that both your CVS server and client are on unix boxes, and you want to check out/check in using ssh.

By doing this, you can avoid typing password each time. Other than CVS settings, it mainly discusses how to set ssh login from one unix server to anohter. Here are the steps.

1. On your client unix, you first need to have environment variables below set:
    export CVSROOT=:ext:<your_cvs_account>@<cvs_server_name>:<cvs_root_dir>
    export CVS_RSH=ssh
    export CVS_SERVER=/usr/local/bin/cvs (or where your cvs is installed on server side)
You may put them in .profile file under your home.

2. Generate key pair on client unix using dsa
    cd ~/.ssh ssh-keygen –t dsa 
Just hit “Return” key when prompted with “Enter passphrase”. You’ll then find two new files created: id_dsa and id_dsa.pub.
    cat id_dsa.pub
Copy the content (you'll paste it on server side in next step).

3. Copy the public key to cvs server.
Login to cvs server using your account:
    cd .ssh
    vi authorized_keys
Add a new line at the end, and paste the content (copied from previous step). Save and quit.
Note: it may be authorized_keys2 depends on the ssh version.

4. Do a test on client unix.
    ssh <cvs_server>
It should let you in without asking for password.

5. Now you can use cvs as usual.
    cvs co <cvs_path>

No comments: