libgit2 / libgit2/libgit2sharp
'Too many redirects or authentication replays' on clone from TFS
Nessuno ha ancora preso questa issue.
- Lingua principale
- C#
- Stelle
- 3.5k
- Fork
- 925
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia dalla chiamata a Repository.Clone e dal relativo CredentialsProvider nella riproduzione fornita, quindi confronta la richiesta con il comando git funzionante che invia un’intestazione Authorization Bearer. Riproduci il clone verso TFS e verifica se tale intestazione viene inviata; il lavoro è completato quando il clone autenticato con access token termina senza errori di redirect o di authentication replay.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- csharp, git
- Ambito
- authentication, backend, networking
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 38/100