libgit2 / libgit2/libgit2sharp

LibGit2Sharp.LibGit2SharpException:“too many redirects or authentication replays”

Open
#2,119 0 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 get LibGit2Sharp.LibGit2SharpException:“too many redirects or authentication replays” when I push the repository.
I use username&&password in CredentialsProvider

using var repo = new Repository(rootPath);
var options = new PushOptions
{
    CredentialsProvider = (url, user, cred) =>
        new UsernamePasswordCredentials { Username = userName, Password = password },
};

var remoteName = "origin";
var remote = repo.Network.Remotes.FirstOrDefault(r => r.Name == remoteName);
 if (remote == null)
{
     repo.Network.Remotes.Add(remoteName, res);
}

 var branch = repo.Branches["main"];
if (branch == null)
 {
     branch = repo.CreateBranch("main");
 }
repo.Branches.Update(branch, b => b.Remote = remoteName, b => b.UpstreamBranch = branch.CanonicalName);
repo.Network.Push(branch, options);

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

Begin at the PushOptions.CredentialsProvider and repo.Network.Push calls shown in the report, then reproduce the push with the stated username and password setup. Compare the resulting redirect or authentication behavior with the configured remote; done requires identifying a reproducible cause and corrective change, but the issue names no source file or test target.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, git
Domain
tooling
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.