git svn - 无法识别的 URL 方案错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13571944/
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
git svn - Unrecognized URL scheme error
提问by Eugene
I'm getting the following error on attempt to clone svn rep with git svn:
尝试使用 git svn 克隆 svn rep 时出现以下错误:
eugene$ git svn clone https://my.site/svn/ here
Initialized empty Git repository in /Users/eugene/Documents/workspace/test/here/.git/
Bad URL passed to RA layer: Unrecognized URL scheme for 'https://my.site/svn' at /usr/local/git/lib/perl5/site_perl/Git/SVN.pm line 148.
svn checkout https://my.site/svn/
works just fine.
svn checkout https://my.site/svn/
工作得很好。
I've re-run
我重新跑了
cpan SVN::Core
and install finished fine, but still getting the error.
并安装完成,但仍然出现错误。
回答by vadishev
Apparently you have two different versions of Subversion binaries and one of those versions does not support http(s)://
protocol.
显然,您有两个不同版本的 Subversion 二进制文件,其中一个版本不支持http(s)://
协议。
If you run svn --version
the output should include something like this:
如果你运行svn --version
输出应该包括这样的东西:
* ra_neon : Module for accessing a repository via WebDAV protocol using Neon.
- handles 'http' scheme
- handles 'https' scheme
or
或者
* ra_serf : Module for accessing a repository via WebDAV protocol using serf.
- handles 'http' scheme
- handles 'https' scheme
The problem is that git-svn
does not use the same binaries. Instead it uses another version of SVN that compiledwith no support for http(s):// protocol. There may be different reasons for that:
问题是git-svn
不使用相同的二进制文件。相反,它使用另一个版本的 SVN,该版本在编译时不支持 http(s):// 协议。可能有不同的原因:
If
svn --version -q
prints1.7.x
, most probably your Git installation is too old to use this version of SVN. So, you might want to upgrade it as latest versions ofgit-svn
support SVN 1.7.If your default SVN installation has no Perl binding installed, SVN::Core uses the binaries with no http(s) support as a fallback. So, you might want to enable Perl bindings for SVN.
Finally, due to some misconfiguration of Perl modules, PATH/LD_LIBRARY_PATH or PERL5LIB (or whatever
git-svn
uses to find the libraries — I'm no expert here),git-svn
just uses invalid binaries.
如果
svn --version -q
打印1.7.x
,很可能您的 Git 安装太旧,无法使用此版本的 SVN。因此,您可能希望将其升级为git-svn
支持 SVN 1.7 的最新版本。如果您的默认 SVN 安装没有安装 Perl 绑定,则 SVN::Core 使用不支持 http(s) 的二进制文件作为后备。因此,您可能希望为 SVN 启用 Perl 绑定。
最后,由于 Perl 模块的一些错误配置,PATH/LD_LIBRARY_PATH 或 PERL5LIB(或任何
git-svn
用于查找库的东西——我不是这里的专家),git-svn
只使用无效的二进制文件。
The particular steps on fixing the issue depend on how you manage the packages, e.g. with Homebrew that'd look like this:
解决问题的特定步骤取决于您如何管理软件包,例如使用 Homebrew 看起来像这样:
$ brew remove svn
$ brew install --with-perl svn
or
或者
$ brew remove git
$ brew install git
Or with MacPorts something like this:
或者使用 MacPorts 是这样的:
$ port install subversion-perlbindings
or
或者
$ port upgrade git-core +svn
After that try to specify a proper library path. E.g. if which svn
prints /usr/local/bin/svn
, try to use /usr/local/lib
as a library path for Perl modules.
之后尝试指定正确的库路径。例如,如果which svn
prints /usr/local/bin/svn
,请尝试/usr/local/lib
用作 Perl 模块的库路径。
Hope that helps.
希望有帮助。
回答by Mightymuke
Can you do: git svn --version
你可以做: git svn --version
See this question: How to upgrade the SVN version used by git-svn
看这个问题:如何升级git-svn使用的SVN版本
UPDATE
更新
Please note that this answer was in response to the posters original version of the question where the issue may have been related to using an older version of svn
in git-svn
. The poster has since upgraded git, determined that it wasn't the cause, and adjusted the question to reflect that.
请注意,此答案是对问题的海报原始版本的回应,该问题可能与使用旧版本的svn
in 相关git-svn
。发帖人已经升级了 git,确定这不是原因,并调整了问题以反映这一点。
回答by kenorb
This is probably related to incompability of SVN::Core perl library or XCode commandline tools update.
这可能与 SVN::Core perl 库或 XCode 命令行工具更新的不兼容有关。
You can try to upgrade it locally:
您可以尝试在本地升级:
cpan SVN::Core
or globally:
或全球:
sudo cpan SVN::Core
or if you're using brew, try to install it via brew:
或者,如果您正在使用 brew,请尝试通过 brew 安装它:
brew install --perl subversion
brew reinstall git
If it still doesn't work, please check our PERL5LIB variable:
如果它仍然不起作用,请检查我们的 PERL5LIB 变量:
echo $PERL5LIB
if it's set to something that you don't want, you can unset it for testing:
如果它设置为您不想要的东西,您可以取消设置以进行测试:
unset PERL5LIB
If that helps, find the file which is defined (e.g. ~/.profile) and remove it from there.
如果有帮助,请找到定义的文件(例如 ~/.profile)并将其从那里删除。
If you've multiple perl libraries, you can specify PERL5LIB environment variable in your ~/.profile
file, e.g.
如果您有多个 perl 库,则可以在~/.profile
文件中指定 PERL5LIB 环境变量,例如
export PERL5LIB="/Users/my_user/perl5/lib/perl5:/Library/Perl/5.16:/Applications/Xcode.app/Contents/Developer/Library/Perl/5.16"
Sometimes the problem simply lays in pointing PERL5LIB to the older version of perl library, e.g. 5.12 instead of 5.16.
有时问题仅仅在于将 PERL5LIB 指向旧版本的 perl 库,例如 5.12 而不是 5.16。
The easy way to find your all instances of SVN::Core, you may try:
找到所有 SVN::Core 实例的简单方法,您可以尝试:
sudo /usr/libexec/locate.updatedb # Only for the first time
locate Core.pm | grep Core.pm$
Related articles:
相关文章:
回答by VinceStyling
When I encountered this error again after upgrade MacOS to Mojave, I think I can also do the trick as I did before by brew reinstall git
, just like I commented on the accepted answer.
当我在将 MacOS 升级到 Mojave 后再次遇到此错误时,我想我也可以像以前一样通过brew reinstall git
,就像我对已接受的答案发表评论一样。
but I failed unfortunately. Any others information I searched can't give me help. So I uninstall git completely by truncate the install artifacts.
但不幸的是我失败了。我搜索的任何其他信息都无法帮助我。所以我通过截断安装工件来完全卸载 git。
$ cd /usr/local
$ sudo rm -fr git
$ sudo rm -fr /usr/bin/git*
now install the lastest version of git/git-svn via brew:
现在通过brew安装最新版本的 git/git-svn :
$ brew install git
$ git --version
git version 2.19.2
$ brew install git-svn
when install finish, I enter my project's root dir and examine whether it can work or not :
安装完成后,我输入项目的根目录并检查它是否可以工作:
$ cd <my project's root dir>
$ git svn rebase
here output the repository updates
the git-svn pull information ended up show me, which means it worked again.
git-svn pull 信息最终向我展示了,这意味着它再次起作用了。
now the version infos is :
现在版本信息是:
$ git --version
git-svn version 2.19.2 (svn 1.10.0)
before is :
之前是:
$ git svn --version
git-svn version 2.19.0 (svn 1.8.11)