CVS error: server reported an error while performing the “cvs add” command. common: cvs server: [filename] added independently by second party.

When trying to replace some old files in my local workspace, then commit the new ones to CVS, I got this error:

    The server reported an error while performing the “cvs commit” command. myproject: cvs server: failed to create lock directory for `/cvsrepositories/path_to/myproject’ (/cvsrepositories/path_to/myproject/subfolder/#cvs.lock): No such file or directory common: cvs server: lock failed – giving up myproject: cvs [server aborted]: lock failed – giving up – did not match any documents.

It turned out that the files had been previously stored in another CVS repository, with a different directory structure. Some of the directories still had CVS folders with pointers to the old repository directories and hostname.

I went through all the CVS folders in each directory and changed the paths and hosts to make sure there were no incorrect pointers, but I still got this error when trying to commit the changed files.

Finally I found a way to get it to accept the new versions of the files:

  • Synchronize the files.
  • Mark them all as “Merged”.
  • THEN you can commit them, and it will not complain.