Moving from SourceForge to GitHub

After feeling the decline of SourceForge for some time now and kind of naturally having nearly all of my repositories on GitHub, I decided to finally move my older repositories. Unfortunately GitHub’s importer does not support CVS. Here’s how I managed it anyway.

This is in no way a beginners guide. You need to know CVS, git and how to install missing packages on your system. I’m doing this on an Ubuntu 14.04 box. Your commands my vary.

That being said, I would like to start with the useful stuff, skipping all my failures so far.
I’ve 3 projects on SF and would like to show it on the example of moving “Look at the stars” – let’s go!

CVS: -d:pserver:[email protected]:/cvsroot/lats

Steps as follows:

  1. Create the repository lats on GitHub.
  2. Locally clone the repository.
  3. Create an initial empty commit like this:
    git commit --allow-empty -m 'Initial commit'
  4. Import the main branch from CVS:
    $ git cvsimport -v -d :pserver:[email protected]:/cvsroot/lats lats -o master -k
  5. The branch is being imported as “vendor”. But I want it to be called by what it is. So I renamed it:
  6. $ git branch -m vendor release-0.6
  7. Import the other, older branch from CVS:
  8. $ git cvsimport -v -d :pserver:[email protected]:/cvsroot/lats Look_at_the_stars-0.5 -o master -k
  9. Rename it to something useful:
  10. $ git branch -m TheBlackLion release-0.5
  11. Push everything to GitHub:
  12. $ git push --all
  13. Go to the branch settings on GitHub and make the newest the default. You might want to merge into master here instead. But for my very old stuff this is perfectly fine.
  14. Create a branch for our files:
  15. $ git checkout master
    $ git branch sf-files
    $ git checkout sf-files
  16. Pull them out of SF:
  17. $ rsync -av --rsh="ssh -l theblacklion" [email protected]:/home/frs/project/lats/ .
  18. Commit and push them:
  19. $ git add .
    $ git commit -m "Import of SF files."
    $ git push --set-upstream origin sf-files
  20. Create a branch for our website:
  21. $ git checkout master
    $ git branch sf-pages
    $ git checkout sf-pages
  22. Pull it out of SF:
  23. $ rsync -av --rsh="ssh -l theblacklion" [email protected]:/home/project-web/lats/ .
  24. Commit and push it:
  25. $ git add .
    $ git commit -m "Import of SF homepage."
    $ git push --set-upstream origin sf-pages

Finally you might want to get the page running on another server for later presentation. I will leave this as an exercise for the reader.

Thank you for reading!

Also published on Medium.