【问题标题】:Why do I get an authentication error when checking if a branch exists in svn?为什么在检查 svn 中是否存在分支时会出现身份验证错误?
【发布时间】:2020-07-19 23:23:34
【问题描述】:

当有人提交时,我需要确定将其添加到我们内部版本控制器中的哪个项目。其中一个因素是是否创建了某个分支。

我有这个功能:

私有静态字符串SVN(字符串命令) { StringBuilder 输出 = new StringBuilder(); 进程 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();
}

被调用的是:

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

然后检查 nextRelease 是否为空。 这适用于我本地 repo 上的本地 PC,但是当我在服务器上安装提交挂钩时,我收到如下错误:

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 不提供我能找到的这些信息,并且用户可能是 SVN 用户,因此它可以访问 SVN。

我错过了什么?

【问题讨论】:

    标签: svn post-commit-hook


    【解决方案1】:

    运行 svn.exe 客户端的用户帐户没有https://server:port/svn/repo/branches/ 及其子级或https://server:port/svn/repo/branches/branchname 的权限。仔细检查权限。

    请阅读文章KB33: Understanding VisualSVN Server authorization

    【讨论】:

    • 我以为提交钩子是按照提交使用的方式运行的?如果是这样,我所在的组对目录具有读/写权限?
    • @stefan 没有。挂钩在服务器的服务帐户下运行。
    • @Stefan 仅供参考:如果您在服务器端使用基本身份验证,那么您需要在对服务器进行身份验证时指定用户名和密码。但是,我假设您使用集成 Windows 身份验证(即 AD 单点登录)。
    猜你喜欢
    • 1970-01-01
    • 2021-02-02
    • 2016-04-25
    • 2020-08-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-26
    • 1970-01-01
    相关资源
    最近更新 更多