0

I am migrating a SVN project to Git. SVN project has following structure within repository.

/trunk
/branches
/tags

Because I want trunk to act as master branch, other branches as normal git branches and tags as git tags.

I ran below command

 git svn clone --stdlayout <svn-repo-url>

and also tried

 git svn clone <svn-repo-url> -T trunk -b branches -t tags

For both above command I get following error:

fatal: .git\svn\refs\remotes\origin\https;C:\Softwares\Git\index: index file open failed: Invalid argument 
        (in cleanup) update-index -z --index-info: command returned error: 128 
W: +empty_dir: branches/<svn-repo-url>/branches 
fatal: Unable to create '<my-git-working-directory>/.git\svn\refs\remotes\origin\https;C:\Softwares\Git\index.lock': Invalid argument 

And if I run below command

git svn clone --trunk=/trunk --branches=/branches --tags=/tags <svn-repo-url>

I am getting following error

svn-remote.svn: remote ref '/Users/<user-id>/AppData/Local/Programs/Git/trunk:refs/remotes/origin/trunk' must start with 'refs/'

Please help

Vampire
  • 35,631
  • 4
  • 76
  • 102
virendrao
  • 1,763
  • 2
  • 22
  • 42

2 Answers2

-1

Since, as part of my job, I've performed many SVN-to-GIT migrations, I've created a wrapping tool for it:

https://github.com/tikalk/tikal-alm-tools/tree/master/scm-tools/scm-migration/manual/SVN2GIT

Also, you can consult me in private

yorammi
  • 6,272
  • 1
  • 28
  • 34
  • can you help on above problem. I cant use this tool – virendrao Sep 15 '16 at 12:19
  • 1
    The structure of each SVN repository and its commits and internal symbolic links makes it hard to create a tool that can convert any SVN repository to GIT. Therefore, each use-case may be different and solved differently. The best practice is usually migrating to GIT without history and in the same time get rid of binary files, old folders. In parallel, keeping the SVN repository in read-only will ease the move to GIT. – yorammi Sep 16 '16 at 13:53
-2

git-svn is not the right tool for one-time conversions of repositories. It is a great tool if you want to use Git as frontend for an existing SVN server, but for one-time conversions you should not use git-svn, but svn2git which is much more suited for this use-case.

There are pleny tools called svn2git, the probably best one is the KDE one from https://github.com/svn-all-fast-export/svn2git. I strongly recommend using that svn2git tool. It is the best I know available out there and it is very flexible in what you can do with its rules files.

If you are not 100% about the history of your repository, svneverever from http://blog.hartwork.org/?p=763 is a great tool to investigate the history of an SVN repository when migrating it to Git.

Vampire
  • 35,631
  • 4
  • 76
  • 102
  • we cant use other tool – virendrao Sep 15 '16 at 12:18
  • Why not? Especially as your requirements are not fulfillable. e. g. you said you want tags as normal Git tags. `git-svn` is **not** capable of that, but SVN tags will become Git branches with a `tags/` prefix. `git2svn` **is** capable of doing it properly, at least if you use the one I recommended. – Vampire Sep 15 '16 at 13:29
  • No it is not capable. You modify the result to get what you want, but the tool does not make it properly. It adds an additional empty commit for each tag and creates the tags as branches, not tags. You still didn't say why you can't use a proper tool for the migration. – Vampire Sep 16 '16 at 09:33