'git-svn clone: unable to connect to a repository

Environment information

~$ git --version
git version 2.11.0
~$ git svn --version
git-svn version 2.11.0 (svn 1.9.5)
~$ svn --version
svn, version 1.9.5 (r1770682)

I'm attempting to clone an internally-hosted SVN repository, but I'm met with the following error:

~$ git svn clone http://[server]/svn/dev1
Initialized empty Git repository in [~]/test/[root]/.git/
Can't create session: Unable to connect to a repository at URL \
  'http://[server]/svn/[root]' at /usr/share/perl5/Git/SVN.pm line 148.

SVN checkout works as expected. I've tried using the svn:// protocol, but then it does not recognize [server] as a known hostname.

If I separate clone into init and fetch, it's the fetch step that is failing.

I should add that solutions like SmartGit are sadly not an option for me; I work at a company with >1000 devs so the cost to support one developer would be astronomical.


SVN.pm:148 reads my $ra = Git::SVN::Ra->new($url); – from elsewhere in my research (I can't find the post anymore), I believe this is a wrapper around an SVN function. Here's the definition of Ra->new:

sub new {
        my ($class, $url) = @_;
        $url = canonicalize_url($url);
        return $RA if ($RA && $RA->url eq $url);

        ::_req_svn();

        $RA = undef;
        my ($config, $baton, $callbacks) = prepare_config_once();
        my $self = SVN::Ra->new(url => $url, auth => $baton,
                              config => $config,
                              pool => SVN::Pool->new,
                              auth_provider_callbacks => $callbacks);
        $RA = bless $self, $class;

        # Make sure its canonicalized
        $self->url($url);
        $self->{svn_path} = $url;
        $self->{repos_root} = $self->get_repos_root;
        $self->{svn_path} =~ s#^\Q$self->{repos_root}\E(/|$)##;
        $self->{cache} = { check_path => { r => 0, data => {} },
                           get_dir => { r => 0, data => {} } };

        return $RA;
}

I don't know Perl, so this is about as far as I can go on my own – I can't find the SVN::Ra->new this mentions.



Solution 1:[1]

As it turns out, this 'machine' (Debian under WSL) wasn't able to access [server] at all (even though Windows could). The error message given may not have been very specific, but it was still accurate: git-svn wasn't able to reach a repository at the given URL because it wasn't able to reach the URL at all!

Fully qualifying it as [server].[company].com worked for me. Instead of

git svn clone http://[server]/svn/dev1

I used

git svn clone http://[server].[company].com/svn/dev1

Solution 2:[2]

Changing the http prefix to svn and using an ip adress was the solution for me. Instead of:

git svn clone http://[server]/svn/dev1

i used:

git svn clone svn://[ip adress]/svn/dev1

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sean Allred
Solution 2 volkit