Note that you will still need svn installed in addition to git. If you are using Mac OSX, svn used to be installed by default but that changed in Mountain Lion (10.8). Since I have XCode already installed, I just went to Xcode > Preferences > Downloads > Command Line Tools > Install. See details here.
Create the Authors Mapping FileThe first step is to create a mapping file for the subversion users to the git users. With the help from here, I run the command below to create the initial mapping file. In my case, the local subversion repository is located at //Users/lerocha/svn-repo:
svn log file:///Users/lerocha/svn-repo | sed -ne 's/^r[^|]*| \([^ ]*\) |.*$/\1 = \1 <\firstname.lastname@example.org>/p' | sort -u > ~/authors.txt
Open the generated file (~/authors.txt) in a text editor and change it from this:
lerocha = lerocha <email@example.com>
lerocha = Luis Rocha <firstname.lastname@example.org>
Convert to a local Git repositoryWith the help from this stackoverflow answer, run the following commands to initialize the local git repository and import the revisions from subversion:
mkdir repo cd repo git svn init file:///Users/lerocha/svn-repo --no-metadata git config svn.authorsfile ~/authors.txt git svn fetch
Your local git repository should contain all revisions from your local subversion.
Push to a remote repositorySince we want to push it to bitbucket.org (private repositories are free!), you first create an empty repository in bitbucket.org and then run the following commands below to push to it:
git remote add origin ssh://email@example.com/youruser/yourrepo.git git push -u origin --all # to push up the repo for the first time