Import svn repository into git

There is post about how to import a Subversion repository into git.

Getting users list bash script:


#!/usr/bin/env bash
authors=$(svn log -q | grep -e '^r' | awk 'BEGIN { FS = "|" } ; { print $2 }' | sort | uniq)
for author in ${authors}; do
  echo "${author} = NAME ";
done

mkdir repo.git && cd repo.git

# init the git repository, do not import quite yet
git-svn init svn://repository_goes_here

# specify mapping from svn users to git users
git config svn.authorsfile ~/authors.txt

# start the import, it may take a while
git-svn fetch

git remote add origin git@YOUR_SERVER_HOSTNAME:repo.git

# enjoy working with git

Config for import:


[svn-remote "svn"]
    url =  svn://repository_goes_here
    #fetch = :refs/remotes/git-svn
    fetch = trunk:refs/remotes/trunk
    branches = branches/{red,green}/src:refs/remotes/branches/*
    tags = tags/{0.1,0.2}:refs/remotes/tags/*



coded by nessus