【发布时间】:2014-11-26 12:13:45
【问题描述】:
这是我用来获取的代码:
public static void GitFetch()
{
var creds = new UsernamePasswordCredentials()
{Username = "user",
Password = "pass"};
var fetchOpts = new FetchOptions {Credentials = creds};
using (repo = new Repository(@"C:\project");)
{
repo.Network.Fetch(repo.Network.Remotes["origin"], fetchOpts);
}
}
但在获取过程中失败并出现以下异常:
LibGit2Sharp.LibGit2SharpException: Too many redirects or authentication replays
Result StackTrace:
at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
at LibGit2Sharp.Core.Proxy.git_remote_fetch(RemoteSafeHandle remote, Signature signature, String logMessage)
at LibGit2Sharp.Network.DoFetch(RemoteSafeHandle remoteHandle, FetchOptions options, Signature signature, String logMessage)
at LibGit2Sharp.Network.Fetch(Remote remote, FetchOptions options, Signature signature, String logMessage)
我已验证配置文件具有所需的远程名称,并且 git fetch 可以从命令行运行。我发现异常来自libgit2\src\transport\winhttp.c,但我想不出解决方法/解决方案。
【问题讨论】:
-
我在对 Azure DevOps 托管的 git 存储库进行身份验证时收到此错误,并且我不小心使用了我的常规凭据而不是个人访问令牌。我知道这不是 OP 的问题,但我想留个便条,以防它对 Google 同事有帮助(很可能是我自己,大约 6 个月后)。
标签: libgit2 libgit2sharp