libgit2 / libgit2/libgit2sharp

Getting exception "too many redirects or authentication replays"

Open
#2,069 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
3.5k
Forks
925
PR merge metrics
No merged PRs in 30d

Description

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"
  };
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied Commands.Pull call, its PullOptions.FetchOptions, and the CredentialsProvider callback; reproduce the exception against GitHub or Azure DevOps using the shown code. Trace the resulting authentication or replay behavior and identify whether the message, retry configuration, or failed-login handling needs clarification, then verify the expected behavior with a focused test if the relevant test location is found.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, git
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.