0

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>
Bishoy
  • 705
  • 9
  • 24
  • Could you please contact me by e-mail (see it in my profile)? An additional question: what protocol are you using (http / svn+ssh / ...)? – Dmitry Pavlenko Mar 09 '16 at 08:35
  • @DmitryPavlenko, your email is not showing on your profile. I am normally using Tortoise and for the first use, it asked me for my username and password once (windows username) and then not again. So I assume it is a username/password access to the repo. Is there a way to query the repo info and check what kind of authentication? and maybe what version as well? – Bishoy Mar 10 '16 at 01:46
  • Also I found the command line svn to be of version 1.7.5. Is this important? How can I make svnkit behaves as if it is svn client 1.7.x – Bishoy Mar 10 '16 at 01:49
  • My e-mail is pavlenko@tmatesoft.com – Dmitry Pavlenko Mar 10 '16 at 06:15
  • Please, can you try it [How to get all files and directories from the SVN repository using java](http://stackoverflow.com/questions/16536149/how-to-get-all-files-and-directories-from-the-svn-repository-using-java) – rgarcial Apr 27 '17 at 07:37

1 Answers1

0

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.

user2959589
  • 362
  • 1
  • 9
  • 23