如何使用“git-svn”签出本地 svn 存储库?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5198331/
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:08:48  来源:igfitidea点击:

How can I use "git-svn" to checkout a local svn repository?

svngitgit-svn

提问by Vicky

I'm practicing how to use svn and git.

我正在练习如何使用 svn 和 git。

I created a svn repository on my computer, at "/Users/name/svnRepo/test". I am able to use the svn commands to work on this repository.

我在我的计算机上创建了一个 svn 存储库,位于“/Users/name/svnRepo/test”。我可以使用 svn 命令来处理这个存储库。

Then, I tried to use command "git-svn clone FILE:///Users/name/svnRepo/test/ .", and got an error:

然后,我尝试使用命令“git-svn clone FILE:///Users/name/svnRepo/test/”。,并得到一个错误:

Initialized empty Git repository in ... Bad URL passed to RA layer: Unable to open an ra_local session to URL: Local URL 'FILE:///Users/name/svnRepo/test' does not contain 'file://' prefix at /usr/local/git/libexec/git-core/git-svn line 1775

在...中初始化空 Git 存储库错误 URL 传递给 RA 层:无法打开 ra_local 会话到 URL:本地 URL 'FILE:///Users/name/svnRepo/test' 不包含 'file://' 前缀在 /usr/local/git/libexec/git-core/git-svn 第 1775 行

Could anyone help?

有人可以帮忙吗?

回答by Ivan Zhakov

Scheme part of URL is case-sensitive. Try to use "git-svn clone file:///Users/name/svnRepo/test/ ." command.

URL 的 Scheme 部分区分大小写。尝试使用“git-svn clone file:///Users/name/svnRepo/test/”。命令。

回答by Archimedes Trajano

If you want to use a local SVN repository with git-svn on Windows, you need to use a downgraded version of the repository until this bug which is marked as wontfix is fixed https://code.google.com/p/msysgit/issues/detail?id=253

如果要在 Windows 上使用带有 git-svn 的本地 SVN 存储库,则需要使用存储库的降级版本,直到修复了标记为 wontfix 的错误https://code.google.com/p/msysgit/问题/细节?id=253

svnadmin create c:\repo --pre-1.4-compatible

Then load up the repository using a dump file

然后使用转储文件加载存储库

svnadmin load C:\repo < svn.dump

Once you have that done you can use the following command

完成后,您可以使用以下命令

git svn clone file:///c/repo git-repo

回答by Matt Vukomanovic

I was having the same problem too. I am running on windows.

我也遇到了同样的问题。我在 Windows 上运行。

I did a work around, I downloaded the VisualSVN serverand pointed that to where my repositories were.

我做了一个解决方案,我下载了VisualSVN 服务器,并将其指向我的存储库所在的位置。

I then needed to add a user to the svn server so that I could pull from it.

然后我需要向 svn 服务器添加一个用户,以便我可以从中提取。

Then instead of trying to run this command

然后而不是尝试运行此命令

git svn clone file:///F:/Repositories/Main/SubProj --stdlayout SubProj

i ran this command instead

我改为运行此命令

git svn clone https://localhost/svn/Main/SubProj --stdlayout SubProj

which worked fine.

效果很好。