This note contains the basic steps to migrate a simple Subversion repository with no branches or tags to Git. For more information, see the Git documentation or go to Stackoverflow.
First, create a list of all contributors to the SVN repository:
cd to-your-svn-checkout
svn log --xml | grep author | sort -u | perl -pe 's/.*>(.*?)<.*/$1 = /' > ~/svn-authors.txt
Edit the svn-authors.txt to include name an e-mail address of each author (it appears that Git requires that). The lines in the file should look like
bs = Burkhard Schmidt <bs@cpfs.mpg.de>
(no author) = No Author <no.author@cpfs.mpg.de>
The last line above avoids errors in the subsequent checkout. Now do a last SVN checkout:
git svn clone --stdlayout --no-metadata --authors-file=~/svn-authors.txt https://svn.cpfs.mpg.de/svn/my_repo
This will create a new Git repository in my-repo and checkout the SVN trunk into a new branch.
Next step: After creating a Git repository on your Github (we use https://github.molgen.mpg.de/bs/my_repo as the example here), add your clone:
cd my_repo
git remote add origin https://github.molgen.mpg.de/bs/my_repo.git
git push -u origin master
At the last step, you will be asked for your Github username and password. For HTTPS commits, this can be safely stored in the OS X keychain issuing
git config --global credential.helper osxkeychain
before the git push
. Henceforth git will fetch the credentials from the OS X keychain.