Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LibGit2Sharp.LibGit2SharpException | too many redirects or authentication replays #2117

Open
belkhir-aziz opened this issue Aug 4, 2024 · 2 comments

Comments

@belkhir-aziz
Copy link

belkhir-aziz commented Aug 4, 2024

I am using LibGit2Sharp (version 0.28.0) with a Personal Access Token to access AZURE Repository.

UsernamePasswordCredentials =>
{
Username = "pat",
Password = PersonalAccessToken
}

CustomHeader => "Authorization: Basic {Convert.ToBase64String(Encoding.UTF8.GetBytes($":{PersonalAccessToken}"))}"

Everything was working as expected until last week, when I started encountering exceptions while trying to interact with the remote repository (e.g., clone, pull, push).

Clone failed. | LibGit2Sharp.LibGit2SharpException | too many redirects or authentication replays
at LibGit2Sharp.Core.Ensure.HandleError(Int32 result) in /
/LibGit2Sharp/Core/Ensure.cs:line 154
at LibGit2Sharp.Core.Ensure.ZeroResult(Int32 result) in //LibGit2Sharp/Core/Ensure.cs:line 172
at LibGit2Sharp.Core.Proxy.git_clone(String url, String workdir, GitCloneOptions& opts) in /
/LibGit2Sharp/Core/Proxy.cs:line 278
at LibGit2Sharp.Repository.Clone(String sourceUrl, String workdirPath, CloneOptions options) in //LibGit2Sharp/Repository.cs:line 824

@ethomson
Copy link
Member

ethomson commented Aug 5, 2024

Did you upgrade anything locally (in other words, change the version of LibGit2Sharp) in the last week? If not, something has changed in Azure Repos.

You're using two authentication methods - first, you're setting UsernamePasswordCredentials, second you're adding your own credentials in the CustomHeader. I would imagine that a remote host would be confused about this. What happens if you only use one of these mechanisms?

@belkhir-aziz
Copy link
Author

belkhir-aziz commented Aug 5, 2024

Thank you for your reply.
No, I haven't changed the version.
It's just that authentication with PAT doesn't work for (push, pull...), I updated the PAT to make sure it's valid.
Using DefaultCredentials() does not give any error.
Everything was ok previous week.

I still get the issue when using one Mechanism only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants