svnpost-commit-hook

Why do I get an authentication error when checking if a branch exists in svn?


When someone commits I need to determine which project to add it to in our in house version controller. One of the factors is whether a certain branch has been created.

I have the function:

private static string SVN(string command) { StringBuilder output = new StringBuilder(); Process procMessage = new Process();

    //Start svnlook.exe in a process and pass it the required command-line args.
    procMessage.StartInfo = new ProcessStartInfo(
        @"C:\Program Files\VisualSVN Server\bin\svn.exe",
        command
    );
    procMessage.StartInfo.RedirectStandardOutput = true;
    procMessage.StartInfo.UseShellExecute = false;
    procMessage.Start();

    //While reading the output of svn, append it to the stringbuilder then
    //return the output.
    while (!procMessage.HasExited)
    {
        output.Append(procMessage.StandardOutput.ReadToEnd());
    }

    return output.ToString();
}

Which is being called with:

                    string nextRelease = SVN("ls https://server:port/svn/repo/branches/branchname");

and then checking whether nextRelease is empty. This works on my local PC on my local repo but when I install the commit hook on the server I get an error like the following:

Error: svn: E170013: Unable to connect to a repository at URL 'https://server:port/svn/repo/branches/branchname'  
Error: svn: E175013: Access to '/svn/repo/branches/branchname' forbidden  

SVNLook does not provide this information that I can find and the user is, presumably, the SVN user so it would have access to SVN.

What am I missing?


Solution

  • The user account that runs the svn.exe client does not have permissions to https://server:port/svn/repo/branches/ and its childs or to https://server:port/svn/repo/branches/branchname. Double-check the permissions.

    Please, read the article KB33: Understanding VisualSVN Server authorization