Importing Subversion repositories to Git

I’m migrating all my source code repositories from Subversion to Git. I tried git-svnimport, but it only works if your repository has the recommended layout of trunk, tags, and branches; unfortunately, a lot of mine don’t. git-svn initially looked like overkill, but it worked quite well. Below is the simple shell script I used to import my repositories and push them to Github; I manually created each repository using Github’s web interface, but it may be possible to script that too.


set -e -f -u -o pipefail

for repo in $( < "${HOME}/repo-list" ); do
    echo "${repo}"
    cd "${HOME}/src"
    git svn clone \
    cd "${repo}"
    git remote add origin "${repo}.git"
    git push origin master