SVNKit身份验证始终失败 [英] SVNKit authentication always fails

查看:417
本文介绍了SVNKit身份验证始终失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用svnkit签出我的代码,尽管我可以成功地使用命令行svn和乌龟访问我的仓库,但它始终返回E170001(禁止403).

我使用svnkit的原因是为了调试使用Jenkins签出时发生的相同问题.

我正在使用Windows PC运行以下客户端代码:

import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.auth.BasicAuthenticationManager;
import org.tmatesoft.svn.core.wc.SVNWCUtil;
import org.tmatesoft.svn.core.wc2.SvnCheckout;
import org.tmatesoft.svn.core.wc2.SvnOperationFactory;
import org.tmatesoft.svn.core.wc2.SvnTarget;

import java.io.File;

public class Application {
    public static void main(String[] args) {
        final SvnOperationFactory svnOperationFactory = new SvnOperationFactory();
        BasicAuthenticationManager auth = BasicAuthenticationManager.newInstance(windows_username, password);
        svnOperationFactory.setAuthenticationManager(auth);

        try {
            final SvnCheckout checkout = svnOperationFactory.createCheckout();
            checkout.setSource(SvnTarget.fromURL(SVNURL.parseURIEncoded(pathToTrunk)));
            checkout.setSingleTarget(SvnTarget.fromFile(new File(targetPathOnDisk)));
            checkout.run();
            System.out.println("Success");
        } catch (SVNException e) {
            e.printStackTrace();
        } finally {
            svnOperationFactory.dispose();
        }
    }
}

这是Maven POM文件中的依赖项:

    <dependency>
        <groupId>org.tmatesoft.svnkit</groupId>
        <artifactId>svnkit</artifactId>
        <version>1.8.11</version>
    </dependency>

解决方案

如果您的服务器使用chroot作为存储库,并且chroot在CHROOT/etc/中没有/etc/passwd的副本,则将得到这个错误.我花了一些时间弄清楚这一点,因为它很奇怪,因为SSH连接有效,签出有效,但提交无效.

I am trying to checkout my code using svnkit and it is always returning E170001 (403 forbidden) although I can successfuly use command line svn and tortoise to access my repo.

The reason why I am using svnkit is to debug the same issue happening when checking out using Jenkins.

I am using a Windows PC for the running the following client code:

import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.auth.BasicAuthenticationManager;
import org.tmatesoft.svn.core.wc.SVNWCUtil;
import org.tmatesoft.svn.core.wc2.SvnCheckout;
import org.tmatesoft.svn.core.wc2.SvnOperationFactory;
import org.tmatesoft.svn.core.wc2.SvnTarget;

import java.io.File;

public class Application {
    public static void main(String[] args) {
        final SvnOperationFactory svnOperationFactory = new SvnOperationFactory();
        BasicAuthenticationManager auth = BasicAuthenticationManager.newInstance(windows_username, password);
        svnOperationFactory.setAuthenticationManager(auth);

        try {
            final SvnCheckout checkout = svnOperationFactory.createCheckout();
            checkout.setSource(SvnTarget.fromURL(SVNURL.parseURIEncoded(pathToTrunk)));
            checkout.setSingleTarget(SvnTarget.fromFile(new File(targetPathOnDisk)));
            checkout.run();
            System.out.println("Success");
        } catch (SVNException e) {
            e.printStackTrace();
        } finally {
            svnOperationFactory.dispose();
        }
    }
}

And this is the dependency in maven POM file:

    <dependency>
        <groupId>org.tmatesoft.svnkit</groupId>
        <artifactId>svnkit</artifactId>
        <version>1.8.11</version>
    </dependency>

解决方案

If your server is using chroot for the repos, and if the chroot doesn't have a copy of /etc/passwd in CHROOT/etc/, you will get this error. It took me some time to figure this one out, because it's weird, because SSH connection works, checkout works, but commit does not work.

这篇关于SVNKit身份验证始终失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆