Accessing git via git-cvsserver via eclipse

Recently I wanted to set up git-cvsserver for some git repositories and a couple of points tripped me up, particularly when trying to access the repositories via eclipse. It all seems obvious with 20:20 hindisight, but i’m posting this in the hope it saves others some time.

  • One thing I didn’t immediately realise, is that there doesn’t have to be a “git-cvsserver” process running on the server if you plan on accessing the repos over ssh via ext
  • The git repository has to be bare and have the following entry in the config file:

   enabled = 1

  • You should be able to checkout the git repo using something similar to the following cvs command:

cvs -d ":ext;CVS_SERVER=git \
	cvsserver:username@server/path/to/repo.git" co master

Checking out a repo via eclipse (as detailed in the git-cvsserver manual) didn’t work. The response from the server always timed out. After trying several permutations it transpires I needed to setup ssh key access between my client and the server. So the steps would be:

  • In eclipse (SSH2 Section), or using ssh-keygen, generate a ssh2 key pair

ssh-keygen -t rsa

  • Manually copy, or use ssh-copy-id, to copy the public key to server (in the ~/.ssh/authorized_keys file)

ssh-copy-id -i ~/.ssh/ username@server

  • In eclipse (Ext Connection Method Section) set the CVS_SERVER parameter to: git cvssserver

To import a project:

  • Choose import projectProjects from CVS
  • Create a new repository location
  • Enter the server details, select Connection type: ext

  • Either enter the branch name directly (e.g. master) or choose from the list (this will connect to the server and so test whether the connection is valid)

  • Choose to checkout the project using the New Project Wizard, or directly name the project

  • Choose a workspace to save the project and click Finish