14

I'm getting the following error on attempt to clone svn rep with git svn:

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.

I've re-run

cpan SVN::Core

and install finished fine, but still getting the error.

Eugene
  • 59,186
  • 91
  • 226
  • 333
  • Is there any reason why you're using the URL `https://my.site/svn/` in your `git svn clone` rather than `https://my.site/svn/rp` as you do in your svn command? Has the error you're getting changed with the git upgrade (ie, is it now the one in update 2, or are you also still getting the original error)? Does your svn repo have the standard branching and tagging conventions (trunk/branches/tags)? – Mightymuke Dec 13 '12 at 04:31
  • No, there is no specific reason about URLs. With git upgrade I'm not getting SSL handshake error anymore, but Unrecognized URL scheme error. The svn repo has no standard branching and tagging, the only trunk folder. – Eugene Dec 13 '12 at 09:03
  • I have updated the desciption not to confuse with obsolete issues. – Eugene Dec 13 '12 at 09:05
  • Thanks. I presume `svn checkout https://my.site/svn/` works ok? ie, `https://my.site/svn/` is a valid repo? – Mightymuke Dec 13 '12 at 09:26
  • Yes, svn checkout https://my.site/svn/ works fine. It is a valid repo. – Eugene Dec 13 '12 at 10:29
  • Have you seen [this post](http://stackoverflow.com/q/3606524/1505426) - seems to be the same issue. (Although as svn works ok for you it may not be related, but possibly worth looking at) – Mightymuke Dec 13 '12 at 17:58

4 Answers4

18

Apparently you have two different versions of Subversion binaries and one of those versions does not support http(s):// protocol.

If you run svn --version the output should include something like this:

* 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 compiled with no support for http(s):// protocol. There may be different reasons for that:

  1. If svn --version -q prints 1.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 of git-svn support SVN 1.7.

  2. 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.

  3. 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.

The particular steps on fixing the issue depend on how you manage the packages, e.g. with Homebrew that'd look like this:

$ brew remove svn
$ brew install --with-perl svn

or

$ brew remove git
$ brew install git

Or with MacPorts something like this:

$ 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.

Hope that helps.

vadishev
  • 2,979
  • 20
  • 28
  • [Possibly related](http://alecthegeek.wordpress.com/2012/03/24/top-tip-bad-url-passed-to-ra-layer-unrecognized-url-scheme-for-when-running-git-svn/): If you are using homebrew for OS X then make sure you install package svn, not subversion. – Mightymuke Dec 13 '12 at 17:56
  • great, the `git svn --version` output is "git-svn version 2.10.1 (svn 1.8.11)", so I reinstall git solved my problem via `brew reinstall git`, now the output of "git version" print **git-svn version 2.17.0 (svn 1.7.20)** – VinceStyling Apr 04 '18 at 02:20
1

Can you do: git svn --version

See this question: How to upgrade the SVN version used by git-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.

Community
  • 1
  • 1
Mightymuke
  • 5,094
  • 2
  • 31
  • 42
0

This is probably related to incompability of SVN::Core perl library or XCode commandline tools update.

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 install --perl subversion
brew reinstall git

If it still doesn't work, please check our PERL5LIB variable:

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.


If you've multiple perl libraries, you can specify PERL5LIB environment variable in your ~/.profile file, e.g.

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.

The easy way to find your all instances of SVN::Core, you may try:

sudo /usr/libexec/locate.updatedb # Only for the first time
locate Core.pm | grep Core.pm$

Related articles:

Community
  • 1
  • 1
kenorb
  • 155,785
  • 88
  • 678
  • 743
0

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.

but I failed unfortunately. Any others information I searched can't give me help. So I uninstall git completely by truncate the install artifacts.

$ 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 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.

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)
VinceStyling
  • 3,707
  • 3
  • 29
  • 44