Git与SVN迁移失败,出现SVN 1.8错误。

20
我正在按照以下步骤将svn仓库转移到git: http://git-scm.com/book/en/v2/Git-and-Other-Systems-Git-as-a-Client。 我的本地svn版本是: $ svn --version svn,版本1.8.10(r1615264) 编译于2014年8月25日10:52:18,位于x86_64-apple-darwin12.5.0上。 git版本是: $ git --version git版本为2.1.0 当我克隆该仓库时,会出现读取本地文件系统格式错误的提示。
$ git svn clone file:///tmp/test-svn -s
Initialized empty Git repository in /private/tmp/test-svn/.git/
Couldn't open a repository: Unable to connect to a repository at URL 'file:///tmp/test-svn': Unable to open an ra_local session to URL: Unable to open repository 'file:///tmp/test-svn': Expected FS format between '1' and '4'; found format '6' at /usr/local/Cellar/git/2.1.0/lib/perl5/site_perl/Git/SVN.pm line 310

根据svn发布说明,svn 1.8引入了FS格式6: http://subversion.apache.org/docs/release-notes/1.8.html#revprop-packing 可能git 2.1 Perl脚本还不兼容这个svn版本。更重要的是,我该如何将这个svn存储库转换为git?

1
我尝试将git升级到最新版本2.2,但仍然出现相同的错误。 - saschwarz
1个回答

33

我在 git-users 邮件列表中得到了一个答案。

解决方案是运行本地 svnserver,并在运行 git svn clone 时使用 svn 协议,而不是file协议。这避免了 git-svn 需要解析 svn 1.8 文件格式。

假设您的存储库位于目录 /path/to/repository/test-svn 中,请切换到 /tmp 目录并运行下面的命令:

svnserve -d -r /path/to/repository

然后您可以运行

git svn clone svn://127.0.0.1/test-svn -s

接下来,停止svnserver并删除临时svn仓库。


10
进入test-svn所在的上级目录(或者你的SVN代码库所在的目录,我用的是这个例子),然后运行svnserve -d --foreground -r .命令。现在,你的代码库URL为svn://localhost/test-svn - Stephen Harrison

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接