不支持从 SVN 迁移到 GIT 请求的身份验证类型

Migrating from SVN to GIT Requested Authentication type(s) are not supported

我正在将我们的组织 svn 存储库迁移到 gitlab 存储库。我查看了许多关于堆栈溢出的不同来源,我试图 link 但我收到警告,我的问题似乎是垃圾邮件。这是我试过的几个 links:tutorial one as well as the read me for svn2git 但没有找到答案。我在 Windows 10。我已经安装了 ruby、svn2git、svn2gitnet(svn2git 但声称允许您输入密码)、TortoiseSVN 和 TortoiseGit。我尝试 运行 命令:

svn2git http://*******-****/******* -v --username ********

svn2gitnet http://*******-****/******* -v --username ******** --password *******

这两个 return

Running command: git svn init --prefix=svn/ --username='********' --no-metadata --trunk='trunk' --tags='tags' --branches='branches' http://*******-****/*******
Initialized empty git repository in C:/Users/********/Desktop/.git/
Can't create session: Unable to connect to a repository at URL 'http://*******-****/*******': Error running context: The requested authentication type(s) are not supported at C:/Program Files/Git/mingw64/share/perl5/Git/SVN.pm line 310.

command failed:
git svn init --prefix=svn/ --username='********' --no-metadata --trunk='trunk' --tags='tags' --branches='branches' http://*******-****/*******

SVN.pm中310行周边模块为:

sub init_remote_config {
    my ($self, $url, $no_write) = @_;
    $url = canonicalize_url($url);
    my $r = read_all_remotes();
    my $existing = find_existing_remote($url, $r);
    if ($existing) {
        unless ($no_write) {
            print STDERR "Using existing ",
                     "[svn-remote \"$existing\"]\n";
        }
        $self->{repo_id} = $existing;
    } elsif ($_minimize_url) {
        my $min_url = Git::SVN::Ra->new($url)->minimize_url;//line 310
        $existing = find_existing_remote($min_url, $r);
        if ($existing) {
            unless ($no_write) {
                print STDERR "Using existing ",
                         "[svn-remote \"$existing\"]\n";
            }
            $self->{repo_id} = $existing;
        }
        if ($min_url ne $url) {
            unless ($no_write) {
                print STDERR "Using higher level of URL: ",
                         "$url => $min_url\n";
            }
            my $old_path = $self->path;
            $url =~ s!^\Q$min_url\E(/|$)!!;
            $url = join_paths($url, $old_path);
            $self->path($url);
            $url = $min_url;
        }
    }
    my $orig_url;
    if (!$existing) {
        # verify that we aren't overwriting anything:
        $orig_url = eval {
            command_oneline('config', '--get',
                    "svn-remote.$self->{repo_id}.url")
        };
        if ($orig_url && ($orig_url ne $url)) {
            die "svn-remote.$self->{repo_id}.url already set: ",
                "$orig_url\nwanted to set to: $url\n";
        }
    }
    my ($xrepo_id, $xpath) = find_ref($self->refname);
    if (!$no_write && defined $xpath) {
        die "svn-remote.$xrepo_id.fetch already set to track ",
            "$xpath:", $self->refname, "\n";
    }
    unless ($no_write) {
        command_noisy('config',
                  "svn-remote.$self->{repo_id}.url", $url);
        my $path = $self->path;
        $path =~ s{^/}{};
        $path =~ s{%([0-9A-F]{2})}{chr hex()}ieg;
        $self->path($path);
        command_noisy('config', '--add',
                  "svn-remote.$self->{repo_id}.fetch",
                  $self->path.":".$self->refname);
    }
    $self->url($url);
}

接下来我应该采取什么步骤?

编辑: 下面的代码行原来是在调用 Subversion 远程访问函数 new。此函数填写一些默认参数,包括身份验证方案。因此,问题很可能是它使用的默认身份验证方案可能不是 NTLM。这是我们的服务器使用的身份验证。也有可能 SVN 确实从传入的 url 中收到了正确的身份验证,但不再支持 NTLM。

my $min_url = Git::SVN::Ra->new($url)->minimize_url;//line 310

解决方案

  • 首先,您必须获取作者文件,以便获取提交历史记录。我在客户端计算机上的 svn repo 目录中的 powershell 中使用了这个命令来打印出每个提交的人的名字:
svn.exe log --quiet | ? { $_ -notlike '-*' } | % { "{0} = {0} <{0}>" -f ($_ -split ' \| ')[1] } | Select-Object -Unique
  • 它应该打印出这样的东西:
     ***\**** = ***\**** <***\****>>     
     ***\**** = ***\**** <***\****>
     ******** = ******** <********>
     ******** = ******** <********>
  • 将其复制到文本文件中并记住位置。修改格式,使每个条目都将其原始 svn 名称分配给名字、姓氏和 :
    ***\**** = *** **** <***@example.com>
    ***\**** = *** **** <***@example.com>
    ******** = **** **** <****@example.com>
    ******** = *** ***** <***@example.com>
  • 然后我获得了对服务器的远程访问权限,并修改了位于 D:\apachesvn\conf 中的 httpd.conf 文件以删除任何试图设置身份验证的内容。如有必要,您可以在迁移后重新添加身份验证。例如这个部分:
<Location /phoneme>
DAV svn
SVNPath "d:/svn/phoneme/"

    AuthName "Subversion Phoneme repositories"
    AuthType SSPI
    NTLMAuth On
    NTLMAuthoritative On
    <RequireAll>
        <RequireAny>
            Require valid-user
            #require sspi-user EMEA\group_name
        </RequireAny>
        <RequireNone>
            Require user "ANONYMOUS LOGON"
            Require user "NT-AUTORITÄT\ANONYMOUS-ANMELDUNG"
        </RequireNone>
    </RequireAll>
    # use this to add the authenticated username to you header
    # so any backend system can fetch the current user
    # rewrite_module needs to be loaded then
    #RewriteEngine On
    #RewriteCond %{LA-U:REMOTE_USER} (.+)
    #RewriteRule . - [E=RU:%1]
    #RequestHeader set X_ISRW_PROXY_AUTH_USER %{RU}e
</Location>
  • 更改为:
<Location /phoneme>
DAV svn
SVNPath "d:/svn/phoneme/"
</Location>
  • 最后,我使用任务管理器在服务器上重新启动了 Apache 2.4 服务,然后回到客户端计算机并使用此命令格式最终将 svn 存储库迁移到 git。
git svn clone "http://repo-url/root" "C:\path\to\new\git\repo" -stdlayout -A "C:/path/to/authors/file/authors.txt"