libgit2 / libgit2/libgit2sharp
'Too many redirects or authentication replays' on clone from TFS
Personne n'a encore pris cette issue.
- Langage dominant
- C#
- Étoiles
- 3.5k
- Forks
- 925
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
After updating to Team Foundation Server TFS 2018 & 2017 Update 3, we are not be able to login to GIT repository using LibGit2Sharp library using Access Token. Please check the code below:
`
string accessToken = "eyJ0eXAiOiJKV1QiLCJ...";
NetworkCredential gitCredentials = new NetworkCredential(string.Empty, accessToken);
string localRepoPath = string.Empty;
string gitTfsRepo = "http://mjtfs2017:8080/tfs/DefaultCollection/_git/GITTest001";
try
{
localRepoPath = Repository.Clone(gitTfsRepo, @"D:\temp\GIT",
new CloneOptions()
{
CredentialsProvider = GetCredentialsHandler(gitCredentials),
IsBare = false
});
}
catch (Exception err)
{
Console.WriteLine(err);
}
Console.WriteLine(localRepoPath);
`
I communicated with Microsoft TFS/VSTS Team they gave following response:
The fact that you received those responses from the code snip I provided means that your extension is correctly configured (regarding scopes at least) and TFS is correctly accepting the extension’s access token to perform git operations through HTTP, when the git client sends it.
Additionally, if I use the next command, using git for Windows, I’m able to fully interact with a TFS repo with that access token:
git -c http.extraheader="Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJ..." clone http://at1-tfs-test1-angallo.westus2.cloudapp.azure.com:8080/tfs/DefaultCollection/_git/test_project_1
But that same command doesn’t work for git for Linux, probably because my git client on my Linux machine doesn’t send or correctly consider these HTTP headers (just as LibGit2Sharp seems to not do too (from your latest Fiddler trace I still see the Authentication header missing)). So I still believe the problem here comes from the git client, not TFS or the access token.
Please suggest, thanks in advance.
LibGit2Sharp version: 0.26.0-preview-0027
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par l’appel à Repository.Clone et à son CredentialsProvider dans la reproduction fournie, puis comparez la requête avec la commande git fonctionnelle qui envoie un en-tête Authorization Bearer. Reproduisez le clone contre TFS et vérifiez si cet en-tête est envoyé ; c’est terminé lorsque le clone authentifié par access token s’achève sans erreur de redirect ni d’authentication replay.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- csharp, git
- Domaine
- authentication, backend, networking
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 38/100