问题描述
当尝试使用以下命令将具有50k +提交的svn存储库迁移到git时:
When trying to migrate an svn repository with 50k+ commits to git using the following commands:
git init
git svn init https://10.10.10.10:8443/svn/rep --stdlayout
git svn fetch --fetch-all --log-window-size=1000 --authors-file=..\authors-transform.txt
报告以下错误:
Connection reset by peer: Error running context: Connection reset by peer at /mingw64/share/perl5/site_perl/Git/SVN/Ra.pm line 312.
我已经尝试再次获取,但是错误仍然存在.
I've already tried to fetch again, but the error persists.
- git:2.12.12
- svn:1.8.11
- 操作系统:Windows 7 x64
任何帮助将不胜感激.
推荐答案
对于一次性迁移,git-svn
不是不是用于存储库或部分存储库转换的正确工具.如果要将Git用作现有SVN服务器的前端,这是一个很好的工具,但是对于一次性转换,您不应该使用git-svn
,而svn2git
则更适合这个用例.
For a one-time migration git-svn
is not the right tool for conversions of repositories or parts 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.
有很多名为svn2git
的工具,可能最好的工具是来自 https://github.com/svn-all-fast-export/svn2git .我强烈建议使用该svn2git
工具.这是我所知道的最好的,它在处理规则文件方面非常灵活.
There are plenty 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.
您将可以轻松配置svn2git
规则文件,以从当前SVN布局中生成所需的结果,还可以通过为其提供命令行选项来使其保持空目录,从而使其保持空目录.gitignore
目录中的文件以保存它们.
You will be easily able to configure svn2git
s rule file to produce the result you want from your current SVN layout and you can also tell it to keep empty directories by giving it a commandline option that causes it to put empty .gitignore
files in the directories to keep them.
如果您不是100%了解存储库的历史记录,请从 http://blog.hartwork.org/?p=763 是将SVN储存库迁移到Git时研究其历史的绝佳工具.
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.
尽管git-svn
较容易入门,但还有一些其他原因为何除了灵活性之外,使用KDE svn2git
代替git-svn
更为优越:
Even though git-svn
is easier to start with, here are some further reasons why using the KDE svn2git
instead of git-svn
is superior, besides its flexibility:
- 通过
svn2git
(如果使用了正确的历史记录),可以更好地重建历史记录,并且更整洁(对于使用分支和合并等更复杂的历史记录,尤其如此) - 标签是真实标签,不是Git中的分支
- 带有
git-svn
的标记包含一个额外的空提交,这也使它们不属于分支,因此普通的fetch
不会获得它们,直到您将--tags
赋予命令为止,因为默认情况下仅指向提取的分支也将被提取.带有正确的svn2git标签是它们所属的地方 - 如果您在SVN中更改了布局,则可以轻松地使用
svn2git
进行配置,而使用git-svn
最终会丢失历史记录 - 使用
svn2git
,您还可以轻松地将一个SVN存储库拆分为多个Git存储库 - 或将同一SVN根目录中的多个SVN存储库轻松组合到一个Git存储库中
- 正确的
svn2git
转换要比git-svn
快几千亿倍
- the history is rebuilt much better and cleaner by
svn2git
(if the correct one is used), this is especially the case for more complex histories with branches and merges and so on - the tags are real tags and not branches in Git
- with
git-svn
the tags contain an extra empty commit which also makes them not part of the branches, so a normalfetch
will not get them until you give--tags
to the command as by default only tags pointing to fetched branches are fetched also. With the proper svn2git tags are where they belong - if you changed layout in SVN you can easily configure this with
svn2git
, withgit-svn
you will loose history eventually - with
svn2git
you can also split one SVN repository into multiple Git repositories easily - or combine multiple SVN repositories in the same SVN root into one Git repository easily
- the conversion is a gazillion times faster with the correct
svn2git
than withgit-svn
您看到,git-svn
较差而KDE svn2git
较优的原因很多. :-)
You see, there are many reasons why git-svn
is worse and the KDE svn2git
is superior. :-)
这篇关于将50k +的svn存储库的50%克隆到git后发生错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!