2014-12-02 109 views
10

失败,我在下面的步骤: http://git-scm.com/book/en/v2/Git-and-Other-Systems-Git-as-a-Client混帐SVN迁移与SVN 1.8

移动一个SVN库与git。我的本地SVN版本是:

$ svn --version svn, version 1.8.10 (r1615264) compiled Aug 25 2014, 10:52:18 on x86_64-apple-darwin12.5.0

Git版本:

$ git --version git version 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发布的说明,FS格式6在svn 1.8中引入: http://subversion.apache.org/docs/release-notes/1.8.html#revprop-packing

难道是git 2.1 Perl脚本还不兼容这个svn版本吗?更重要的是,我怎样才能让这个svn库转换成git?

+0

我试着将git升级到最新版本2.2并仍然得到相同的错误。 – saschwarz 2014-12-02 03:47:38

回答

17

我在git-users电子邮件列表上找到了答案。

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

因此,我更改为/tmp目录并运行svnserve -d。 我当时能够git svn clone svn://127.0.0.1/test-svn -s,它完美无缺。然后我停止了svnserver并删除了临时的svn仓库。

+0

请问您可以写一个带'svnserve'命令行和'ssh:// ...'的路径的例子吗? – Kromster 2015-03-21 10:31:38

+8

'cd'到'test-svn'的父目录(或者你的SVN回购被称为 - 我正在使用这个例子)。然后运行'svnserve -d --foreground -r .'。您的repo网址现在是'svn:// localhost/test-svn'。 – 2015-05-22 14:48:15

+0

在你的回答中不应该是'svn://'而不是'ssh://'? – 2016-01-14 23:45:13