Notes from the migration of my personal SVN repo to Git and also onto the hosted Git platform Bitbucket.org.

First step was to tell my local git install who I was:

$ git config --global user.name "Robin Kearney"
$ git config --global user.email "robin@kearney.co.uk"

I always set the following too:

$ git config --global color.diff auto
$ git config --global color.status auto
$ git config --global color.branch auto

Then to import a section of my SVN repo:

$ git svn clone --authors-file=path/to/authors_file SVN_REPO_URL LOCAL_DIR
$ cd LOCAL_DIR
$ git svn show-ignore > .gitignore
$ git remote add origin git@bitbucket.org:rk295/GIT_REPO.git
$ git push origin master

Some people advise using -s on the ‘git svn’ command, which tells git to expect trunk/ tags/ etc. But I dont use those in my repo, so I omitted it.

SVN_REPO_URL is the full http://…. URL to the SVN repo to import, or in my case a sub-section of it.

The --authors-file tells git the location of a text file which maps SVN users to Git users, mine looked like this:

robin = Robin Kearney <robin@kearney.co.uk>