Haxton Fale
Haxton Fale

Reputation: 574

SharpSVN doesn't want to use credentials

I am trying to make SharpSVN log in to a repository with stored credentials, but according to access logs it never actually offers any. I have the following bit in my code:

internal static SvnClient SvnClient
{
    get
    {
        if (_svnClient != null) return _svnClient;

        _svnClient = new SvnClient();
        _svnClient.Authentication.AddConsoleHandlers();
        var user = Environment.GetEnvironmentVariable("svnuser");
        var pass = Environment.GetEnvironmentVariable("svnpass");
        if (user != null && pass != null)
        {
            _svnClient.Authentication.ForceCredentials(user, pass);
        }
        _svnClient.Authentication.SslServerTrustHandlers += (
            (sender, e) =>
            {
                e.AcceptedFailures = SvnCertificateTrustFailures.UnknownCertificateAuthority;
                e.Save = true;
            });

        return _svnClient;
    }
}

private static SvnClient _svnClient;

What I find the most confusing is that this setup used to work. I know the correct credentials are being picked up, that they work with the repository, that the machine can see the repository, but investigating the access logs I just see the client trying once with no creds, getting a 401, and dying with an exception No more credentials or we tried too many times. What could be going wrong/how to get it to work?

Upvotes: 0

Views: 72

Answers (0)

Related Questions