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

时间:2019-07-24 15:57:41

标签: git svn gitlab git-svn svn2git

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

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

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

两者都返回

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($1)}ieg;
        $self->path($path);
        command_noisy('config', '--add',
                  "svn-remote.$self->{repo_id}.fetch",
                  $self->path.":".$self->refname);
    }
    $self->url($url);
}

我应该采取什么下一步措施?

1 个答案:

答案 0 :(得分:0)

解决方案

  • 首先,您必须获取authors文件,才能获取提交历史记录。我在客户端计算机上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"