Search code examples
gitcvs

converting cvs repositories to git


How to convert a CVS repository to a git repository?

  • I have tried using git cvsimport command like this:

    git cvsimport -v -d :pserver:thillaiselvan@(my_cvs_server_root) -r cvs -k (module_name)

  • But the process stalls in the middle for minutes with this message:

    cvs [rlog aborted]: could not chdir to file_name_config: Permission denied

  • Despite that a directory is created with .git but shows fatal error when trying to check git log:

    git log

    fatal: bad default revision 'HEAD'

  • On checking the status:

    git status

    On branch master

    Initial commit

    nothing to commit (create/copy files and use "git add" to track)


Solution

  • I use git --bare cvsimport -d:local:/cvsroot/$PROJECT -v -k -m -i -A Authors -o master $PROJECT to import cvs project from the local repository (or mirror) into a local bare git repository that is suitable for being exposed to remote developers. This can do incremental updates if you are still using CVS as the primary repository.

    However you should also look at cvs2git as this can be better sometimes but is more appropriate for a one-off conversion to git. cvsimport can have trouble with vendor branches so it is important to very carefully check your newly imported repository. In both cases it can take a long time for large repositories (possibly hours on a slower machine with a 10year old cvs repository).