libgit2 / libgit2/libgit2sharp

"Too many redirects or authentication replays" when pushing changes

Open
#1,419 20 comments 1 reaction 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

Hi,

have been search for this for a day and some people mentioned it is a bug.
I can clone, stage and commit, but the push always fails.
Command line push works fine

ClonedRepoPath = @"c:\temp\test"
_params.ClonedRepoPath = "http://172.16.40.129/test/Interfaces.git"

clone:
` if (!Directory.Exists(_params.ClonedRepoPath))
{
Directory.CreateDirectory(_params.ClonedRepoPath);
}

        var result = Repository.Clone(_params.ServerPath, _params.ClonedRepoPath);

`

stage, commit and push
`
using (var repo = new Repository(_params.ClonedRepoPath))
{
if (repo.Network.Remotes.All(r => r.Name != name))
{
repo.Network.Remotes.Add(name, _params.ServerPath);
}

           Commands.Stage(repo, "*");

           if (repo.RetrieveStatus().IsDirty)
           {
              Commit commit = repo.Commit("CodeGen commit", new Signature(_params.UserName, _params.EmailAddress, System.DateTimeOffset.Now)
                                                          , new Signature(_params.UserName, _params.EmailAddress, System.DateTimeOffset.Now));

              var options = new PushOptions{
                                              CredentialsProvider = (_url, _user, _cred) => new DefaultCredentials()
                                           };

              repo.Network.Push(repo.Network.Remotes["origin"], @"refs/heads/master", 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

No repository file or test is named. Start with the Push call and PushOptions/CredentialsProvider shown in the report, then compare its authentication setup with the command-line push that succeeds. Done requires reproducing the failure and identifying the configuration or code change that makes library pushes succeed.

Written by the indexing model from the issue text.

Assessment

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