libgit2 / libgit2/libgit2sharp

Getting exception "too many redirects or authentication replays"

未關閉
#2,069 3 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

主要語言
C#
星號
3.5k
分支
925
PR 合併指標
30 天內沒有已合併 PR

描述

I am trying to pull from a github repository with the following code getting an exception "too many redirects or authentication replays". Why? If I failed to login, I expect an exception telling me that. Also the exception suggests that it retried whatever it did a couple of times although "replay" needs clarification. Where do I configure the number of retries if any? I have no interest in trying more than once. I have checked the credentials many times and also I tried to pull from an azure devops repo with the same result.

public void dothepulling()
{
  string repoPath = "C:\\project\\test.git";

  using (var repo = new Repository(repoPath))
  {

    var FetchOptions = new FetchOptions
    {
      CredentialsProvider = func
    };

    var pullOptions = new PullOptions
    {
      MergeOptions = new MergeOptions
      {
        FastForwardStrategy = FastForwardStrategy.FastForwardOnly,
        FileConflictStrategy = CheckoutFileConflictStrategy.Theirs,
        IgnoreWhitespaceChange = false
      },
      FetchOptions = FetchOptions
    };

    var signature = new Signature(new Identity("Firstname Lastname", 
      "my.email.@address.com"), DateTimeOffset.Now);

    Commands.Pull(repo, signature, pullOptions);
  }
}

private UsernamePasswordCredentials func(string url, string user,
  SupportedCredentialTypes types)
{
  return new UsernamePasswordCredentials
  {
    Username = "username",
    Password = "password"
  };
}

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

從提供的 Commands.Pull 呼叫、其 PullOptions.FetchOptions 以及 CredentialsProvider 回呼開始;使用所示程式碼在 GitHub 或 Azure DevOps 上重現該例外。追蹤由此產生的驗證或 replay 行為,並確認是否需要釐清訊息、重試設定或登入失敗處理,然後在找到相關測試位置的情況下,透過一個聚焦的測試驗證預期行為。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
csharp, git
領域
devtools
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
需要釐清
新手友好度
25/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。