This is a post that details on how to sync a subversion repository to git repository on, and how to keep it in sync.

The following sites were instrumental in getting this to work:

There are a number of steps to take. From a bird’s eye view:

  1. Use git svn to clone the svn repo to a git repo;
  2. Create a github git repo;
  3. Add a remote origin in your local git to the remote github repo;
  4. Use some SSH foo to use a separate SSH key for pushing to


  • We are working with the fictional svn repo located at;
  • git-svn is installed;
  • ssh is installed.

Clone the repository

git svn clone -s

Create github repo

Go to the’s website and create a new repository, in this case we’ll use my username (miekg). So the’s repository is:

Add a remote in (local) git

git remote add origin

And push the contents to the remote (i.e. github):

git push origin master

And voila. You have a git repository from a cloned svn repository.

Keeping it in sync

Ideally you want to run a cronjob to keep this repository in sync with the subversion repository. The git commands used are trivial:

git svn rebase
git push

However the ssh key you’re using has a passphrase. An idea is to use a separate key (without a passphrase) just for this repository. Sadly it is not possible to restrict a ssh key to a specific repository, so this new, passphrase-less key can be used to update all your repositories.

But still this can be useful, so how do you set this up?

  1. First create a new key pair: ssh-keygen -f

  2. Create a Host-stanza in ~/.ssh/config:

         User git
         IdentityFile ~/.ssh/
  3. Use the “fake” host ( as the remote branch in git:

     git remote add origin

    If you already added the remote you can just edit .git/config and make the change there.

  4. Any git push will now use the ssh-server, the user git and the identity file ~/.ssh/ and will not prompt for a passphrase.

Dealing with changes/patches

The hard part is getting changes made in this git repository back upstream (in the origin subversion repository). You can do this with git, but it gets complicated (IMHO).

A simpler idea is just to not touch this git repository, but fork it, make your changes there and send the patch to the maintainer of the subversion repository. The git repository then gets synchronized again (hopefully with your changes).