Migrate your Subversion repos to Git

I’ve been using Subversion for years for my code versioning needs. Lately, I’ve been using Git more often. But I still have a bunch of SVN repositories. The task: migrate everything to a private Git repo.

There’s the geeky, harder way. There’s the easier, hacky way. I choose the hacky way anytime of the day.

The hacky way involves Github’s SVN import tool. Here’s the step by step process.

1. Go to https://import.github.com/new, Github’s import tool, and enter your SVN’s active URL. Depending on your current SVN’s settings, you’ll be asked to place in your username and password again. Mine was private so, I had to place in the SVN credentials so Github can pull and convert the repository.

GitHub_Importer

After it’s done, you go to your Github account and review the imported codes.

2. Create your local repository and pull the new Github repository

$ mkdir
$ cd
$ git init
$ git remote add origin https://github.com/[username]/[new-repo].git
$ git pull

You can stop right here if you want to host your code on Github’s public repository. In my case, I want it private. I found Gitlab to be hosting free private Git repositories. So, go ahead and create a Gitlab account and (or, where ever you want your codes to be hosted privately).

3. Push your new code to the private repository

$ git remote add gitlab git@gitlab.com:[username]/[new-repo].git
$ git push gilab master

4. Delete your Github’s public repo.

Summary: in essence, we should thank Github for making this hack possible ;)