Git SVN 无法从 SVN 存储库中获取

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5113170/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 05:06:38  来源:igfitidea点击:

Git SVN Is Unable to Fetch from SVN Repository

svngitgit-svn

提问by Sambath Prum

I'd like to use SVN and Git together. I have an svn repository, and I'm trying to fetch to a working directory, but I encounter an error as below.

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

svn, version 1.6.6 (r40053)

svn,版本 1.6.6 (r40053)

git version 1.7.3.1.msysgit.0

git 版本 1.7.3.1.msysgit.0

The svn repository path is file:///d:/tmp/test-svn/repos

svn 仓库路径是file:///d:/tmp/test-svn/repos

These are the steps I did:

这些是我做的步骤:

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

So what is the issue? How can I fetch data from svn repository to the git working directory?

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

Thank you.

谢谢你。

回答by tekumara

I think this is the following issue: http://code.google.com/p/msysgit/issues/detail?id=298

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

Possible solution is to setup svnserve and use the svn://protocol instead of file:///

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

See here for setting up svnserve on Windows: http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-serversetup-svnserve.html

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

UPDATE

更新

svnserveis available as a part of TortoiseSVN if you use Windows OS (I checked with TortoiseSVN version 1.8.6)

svnserve如果您使用 Windows 操作系统,则可作为 TortoiseSVN 的一部分使用(我检查了 TortoiseSVN 版本 1.8.6)

Then you just start:

然后你就开始:

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

and clone the repository with following command:

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

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

回答by Dmitry Pavlenko

I can propose to clone your repository with SmartGit. It have git-svn functionality implemented in java, which is significantly faster than git-svn and outperforms it. Hope it will work for you.

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

But if you have an access to your SVN repository server I recommend you to install SubGitinto it. In this case you will get a Git repository that is automatically synchronized with SVN repository (and concurrent-safe).

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

Both approaches has large advantages over git-svn like: automatical tags, ignores, EOLs translation. SubGit also tries to preserve dates as it is possible while committing to SVN.

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