Git SVN无法从SVN存储库获取

时间:2011-02-25 03:08:06

标签: svn git git-svn

我想一起使用SVN和Git。我有一个svn存储库,我正在尝试获取工作目录,但我遇到如下错误。

svn,版本1.6.6(r40053)

git版本1.7.3.1.msysgit.0

svn存储库路径为 file:/// d:/ tmp / test-svn / repos

这些是我做的步骤:

D:\tmp\test-svn>mkdir my-project

D:\tmp\test-svn>cd my-project

D:\tmp\test-svn\my-project>git svn init file:///d:/tmp/test-svn/repos

Initialized empty Git repository in D:/tmp/test-svn/my-project/.git/

D:\tmp\test-svn\my-project>git svn fetch

Couldn't open a repository: Unable to open an ra_local session to URL: Unable to
 open repository 'file:///d:/tmp/test-svn/repos/my-project/trunk': Expected FS f
ormat '2'; found format '4' at C:\Program Files\Git/libexec/git-core/git-svn lin
e 1773

那么问题是什么?如何从svn存储库获取数据到git工作目录?

谢谢。

2 个答案:

答案 0 :(得分:46)

我认为这是以下问题:http://code.google.com/p/msysgit/issues/detail?id=298

可能的解决方案是设置svnserve并使用svn://协议而不是file:///

请参阅此处以在Windows上设置svnserve: http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-serversetup-svnserve.html

<强>更新

如果您使用Windows操作系统(我使用TortoiseSVN版本1.8.6检查),

svnserve可作为TortoiseSVN的一部分提供

然后你就开始:

svnserve -d -R --root c:\path\to\svn\repo

使用以下命令克隆存储库:

git svn clone svn://localhost/path/inside/svn/repo

答案 1 :(得分:1)

我可以建议使用SmartGit克隆您的存储库。它具有在java中实现的git-svn功能,它比git-svn快得多并且优于它。希望它对你有用。

但是如果您可以访问SVN存储库服务器,我建议您在其中安装SubGit。在这种情况下,您将获得一个自动与SVN存储库(和并发安全)同步的Git存储库。

这两种方法都比git-svn具有很大的优势:自动标签,忽略,EOL翻译。 SubGit还会尝试在提交SVN时保留日期。

相关问题