{"id":2442,"date":"2018-03-31T15:11:51","date_gmt":"2018-03-31T20:11:51","guid":{"rendered":"http:\/\/osric.com\/chris\/accidental-developer\/?p=2442"},"modified":"2025-12-16T18:07:42","modified_gmt":"2025-12-16T23:07:42","slug":"converting-cvs-to-git-repository","status":"publish","type":"post","link":"https:\/\/osric.com\/chris\/accidental-developer\/2018\/03\/converting-cvs-to-git-repository\/","title":{"rendered":"Converting a CVS project to a Git repository"},"content":{"rendered":"<p>Why do I still have projects in CVS in 2018?<\/p>\n<ol>\n<li>I inherited them<\/li>\n<li>Inertia<\/li>\n<\/ol>\n<p>Fortunately, the <a href=\"http:\/\/cvs2svn.tigris.org\/\">cvs2svn<\/a> project includes <a href=\"http:\/\/cvs2svn.tigris.org\/cvs2git.html\">cvs2git<\/a>. The instructions included are good, but here are a few things I ran into that may be useful:<\/p>\n<p>You need the actual CVS repo, <em>not<\/em> a checked out copy. If you run <code>cvs2git<\/code> on a checked-out copy, you will get an error message like:<\/p>\n<pre><code>ERROR: No RCS files found under 'projectname'<\/code><\/pre>\n<p>I found that mentioned on <a href=\"here: https:\/\/github.com\/mhagger\/cvs2svn\/issues\/2\">svn2git fails &#8220;ERROR: No RCS files found under&#8230;&#8221;<\/a>. A comment there mentions getting a tarball of your project from Sourceforge, but if you aren&#8217;t working with a Sourceforge project, make your own tarball:<\/p>\n<pre><code>tar -cf cvs.tar.gz \/path\/to\/CVS<\/code><\/pre>\n<p>I created a tarball because I am not running <code>cvs2git<\/code> on the same machine as my actual CVS repo. <code>cvs2git<\/code> is non-destructive, and I have backups in case something goes wrong, but I didn&#8217;t feel like taking any risks (or testing my restore procedures) at that moment.<\/p>\n<p>I ended up running <code>cvs2git<\/code> on a Fedora VM. First, install CVS:<\/p>\n<pre><code>sudo dnf install cvs<\/code><\/pre>\n<p>Install <code>cvs2svn<\/code>:<\/p>\n<pre><code>wget http:\/\/cvs2svn.tigris.org\/files\/documents\/1462\/49543\/cvs2svn-2.5.0.tar.gz\r\ntar -xf cvs2svn-2.5.0.tar.gz\r\ncd cvs2svn-2.5.0\r\nmake install<\/code><\/pre>\n<p>Create the blob and dump files (you&#8217;ll import these into git shortly):<\/p>\n<pre><code>cvs2git --blobfile=\/tmp\/gitblob.dat --dumpfile=\/tmp\/gitdump.dat \/path\/to\/specific\/cvs\/project<\/code><\/pre>\n<p>Create a bare git repository:<\/p>\n<pre><code>git init --bare reponame\r\ncd reponame<\/code><\/pre>\n<p>Import the blob and dump files into the git repository:<\/p>\n<pre><code>cat \/tmp\/gitblob.dat \/tmp\/gitdump.dat | git fast-import<\/code><\/pre>\n<p>Now the CVS project is a git repository! Great, but how do I put a bare repo on GitHub or a GitHub Enterprise instance? The article <a href=\"https:\/\/help.github.com\/enterprise\/2.2\/admin\/articles\/moving-a-repository-from-github-com-to-github-enterprise\/\">Moving a repository from GitHub.com to GitHub Enterprise<\/a> was helpful:<\/p>\n<pre><code>git remote add origin git@[hostname]:[owner]\/[repo-name].git\r\ngit push origin --mirror<\/code><\/pre>\n<p>(It&#8217;s still a bare repo locally, so if you want to check it out you can clone it out to another destination folder, or <code>rm -rf<\/code> the local repo and clone it.)<\/p>\n<p>The last thing I wanted to do: make the current CVS project read-only. That turned out to be more confusing than I expected, so I&#8217;ve turned that into a separate post, <a href=\"https:\/\/osric.com\/chris\/accidental-developer\/2018\/03\/make-a-cvs-project-read-only\/\">Make a CVS project read-only<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What year is it? 2018? And you&#8217;re still using CVS for source control management? Let&#8217;s convert that to Git already using cvs2git.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[232],"tags":[4,314],"class_list":["post-2442","post","type-post","status-publish","format-standard","hentry","category-tips-tricks","tag-cvs","tag-git"],"_links":{"self":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts\/2442","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/comments?post=2442"}],"version-history":[{"count":11,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts\/2442\/revisions"}],"predecessor-version":[{"id":3879,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts\/2442\/revisions\/3879"}],"wp:attachment":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/media?parent=2442"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/categories?post=2442"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/tags?post=2442"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}