7
votes

I'm trying to migrate a repository from SVN to GIT using svn2git. It's an Open Source project, public SVN repository Url is: http://svn.verinice.org/svnroot/. Feel free to test the migration...

SVN repository structure is:

  • BRANCHES
  • TAGS
  • TRUNK

I used the following command to clone this Repo:

svn2git http://svn.verinice.org/svnroot 
  --trunk TRUNK 
  --branches BRANCHES 
  --tags TAGS

But this command only migrates only one branch and no tags at all. I used these commands to check the result:

[user@forge git-repo]# git branch -a
* master
  springy
  remotes/springy
[user@forge git-repo]# git tag -l
[user@forge git-repo]# 

How do I migrate all branches and tags? Thanks for your help!

UPDATE:

After using parameter --authors authors-file.txt and adding Name and Email address to git configuration svn2git works fine:

 git config --global user.name "your name"
 git config --global user.email "[email protected]"

You have to add a line for every SVN user in authors-file.txt:

 svn-user-name = Full Name <[email protected]>

git branch -a and git tag -l now returns all branches and tags.

2

2 Answers

10
votes

I have no experience with svn2git, but you could instead try to use git svn clone to make the switch to git. Note that this will take a very long time. See git help svn for more information.

Note that this will not create proper tags in git, most likely due to the difference in git and svn tags discussed on the svn2git FAQ. Instead, the tool will create tag branches. If you want to turn these into proper tags (and since I'm assuming you won't be going back to SVN at all, this shouldn't cause any harm), there is a discussion here about how to write a script to do just that.

1
votes

What's important to know is that all these tools are built on top of git's native SVN support,git-svn. So one can directly use git-svn for cloning,fetching changesets and etc.., but it's better to have one single script/tool to help us do all our operations during the migration and hence the need for such tools.

I used svn2git wrapper script hosted on https://github.com/nirvdrum/svn2git for subversion to git migration and it helped for sure, especially when we wanted to pull changesets from our subversion repository at periodic intervals as we did not completely shutdown the subversion repo for obvious reasons. You can go through the ruby wrapper script, migration.rb to know more.