26
votes

I'm trying to convert my svn repo to git, but I'm not having much success. The repository in question does not have anything like a "trunk". The layout is the following:

/home/svn/
      |--- /project1/
      |--- /project2/
      |--- /repos/project3/

And underneath those project folders are the files. No trunk, no branches, no nothing special. At the time that was all I needed, and now it's biting me in the ass.

I'm following this guide: http://john.albin.net/git/convert-subversion-to-git

When I run this command:

git svn clone svn+ssh://[email protected]/home/svn/repos/kiflea --no-metadata -A authors-transform.txt --stdlayout ~/kiflea

It says it has created an empty git repository... But I don't really want it to be empty.

I also have no idea what the following commands should look like, since my repository has a different layout.

Commands like git symbolic-ref HEAD refs/heads/trunk or git config remote.bare.push 'refs/remotes/*:refs/heads/*'

2
Remove --stdlayout Do you want to split it to 3 Git repositories?Dmitry Pavlenko
That did it. I tried so many variations, so many commands, but removing the --stdlayout from this one didn't cross my mind. Answer the question so I can give you the bounty ;)skerit
You should have just looked at the manual page (git svn --help). There is even a "BASIC EXAMPLES" section which unsurprisingly contains your exact case.user1338062
"There is no page about gitsvn"skerit

2 Answers

51
votes

Just remove --stdlayout option. It means trunk/branches/tags structure.

4
votes

If you have local access to your SVN repository, I would recommend you to use SubGit for conversion. There're a few simple steps:

$ subgit configure path/to/svn/repository
$ #edit path/to/svn/repository/conf/subgit.conf to specify "core.authorsFile" option to point to your authors-transform.txt
$ subgit install path/to/svn/repository

After that a Git repository will be created and the repositories will be in constant sync. Optionally you may run

$ subgit uninstall path/to/svn/repository

to turn synchronization off.

If you have no local access to your repository, you clone your repository with SmartGit. The effect will similar to "git svn clone" but such SVN concepts like ignores, EOLs-processing options, tags will be also translated to Git (the same I can say about SubGit too).

None of those solutions is based on "git-svn".