CVS/SVN conversion to Git
The are many ways to convert a CVS/SVN repository to a Git equivalent. The following guide will describe the method found by the KTH IT department, to be the most feasible, for most users. It seems to be the most user friendly while at the same rather conservative when it comes to preserving revisions, history etc.
The simplest method is to use porter.github.com and the clone the project to KTH GitHub. But this can only be used for small prject do not need to be restricted from the general public. In the future this feature may be available directly by KTH GitHub.
For those inclined there is also cvs2git/svn2git, it is the least user firendly but the most powerful method.
The preferred method chosen the the KTH IT department is the built-in svn import command of the GitHub client. It is a two-step process; first you import (clone) the SVN-project as a local Git repository. Then you upload (push) the local, converted repository, to an empty pre-created repository at KTH Github.
1. Login to your KTH GitHub website (in the example it will be user brain, on gita.sys.kth.se):
2. Create an empty repository for SVN the project you wish to import (referred to as "kthzilla" in the example).
3. Start a "GIt Shell" (should be in the "Start menu" if using GitHub for Windows), or the terminal if using GitHub for Mac OS X .
4. Go to the folder you wish to import the SVN project to (or create one in the shell/terminal). Then run the command:
git svn clone [address to remote svn repository] [local name]
In our example it is:
git svn clone https://svn.filezilla-project.org/svn/FileZilla3/trunk filezilla
If the command is run from C:\gitrepos (on Windows) or /gitrepos/ (on Mac) it will result in a local git repository locate in
C:\gitrepos\filezilla (on Windows) or /gitrepos/filezilla (on Mac)
If [local name] ("filezilla" in the example) is omiited the name of the subfolder will instead be:
C:\gitrepos\trunk (on Windows) or /gitrepos/trunk (on Mac)
5. Now go inside the projekt folder by running:
cd [local name] ("cd filezilla")
6. Then run the following commands:
git branch -l (will show you what branch name [master/origin] to use in the the next command) git remote add [master/origin] git@[server-name]:[kth.se-username]/[gitreponame].git git push -u [master/origin]
which in the in our example is:
git branch -l (output shows "*master") git remote add master email@example.com:brain/kthzilla.git git push -u master
Assuming everything runs as it should, once the push is complete, the project should be in the "empty" repsitory that was created on KTH GitHub.