问题
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>
回答1:
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.
来源:https://stackoverflow.com/questions/35883908/svnkit-authentication-always-fails