git-tfs: Frequent (and endless) login requests with dev.azure.com
Version used: GitTfs-0.32.0.zip Visual Studio 2019 installed
I’ve just started with git-tfs, and (after some initial try-and-error) was able to get a working git repo with
git tfs clone https://dev.azure.com/xxx '$/yyy/zzz'
During the process, I’ve been prompted for credentials via Login popup once for every (old dependency) remote branch being queried. Issue 1: Is that normal?
While this was annoying, but doable, I then tried to see what I got with
git tfs branch
Issue 2: This gives me a loop of endless user/password prompts
2021-03-16 17:24:35.1909 [Info] Found matching Visual Studio version at C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional
2021-03-16 17:24:35.3359 [Debug] git command: Starting process: git rev-parse --show-prefix
2021-03-16 17:24:35.4509 [Debug] git command time: [00:00:00.1169989] rev-parse --show-prefix
2021-03-16 17:24:35.5639 [Debug] Command run:git tfs branch
2021-03-16 17:24:35.6729 [Debug] No authors file used.
2021-03-16 17:24:35.7680 [Debug] git-tfs version 0.32.0.0 (TFS client library 16.0.0.0 (MS)) (64-bit)
2021-03-16 17:24:35.8599 [Debug] git command: Starting process: git --version
2021-03-16 17:24:35.9769 [Debug] git command time: [00:00:00.1180005] --version
2021-03-16 17:25:10.9379 [Debug] ResolveFWLinkAccountManager statusCode is redirect: 'True'
2021-03-16 17:25:11.0495 [Debug] ResolveFWLinkAccountManager resovled fwlink from 'https://go.microsoft.com/fwlink/?LinkID=xxxxx' to 'https://app.vssps.visualstudio.com/'
No log message after this point during the prompts until I cancel:
2021-03-16 17:25:15.2575 [Debug] System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.TeamFoundation.TeamFoundationServerUnauthorizedException: TF30063: You are not authorized to access https://dev.azure.com/xxxxxxx. ---> System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at Microsoft.VisualStudio.Services.Client.Controls.VssFederatedCredentialPrompt.<Microsoft.VisualStudio.Services.Common.IVssCredentialPrompt.GetTokenAsync>b__23_0(Task`1 t)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at Microsoft.VisualStudio.Services.Common.IssuedTokenProvider.GetTokenOperation.<GetTokenAsync>d__21.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Services.Common.IssuedTokenProvider.<GetTokenAsync>d__34.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.SendRequest()
--- End of inner exception stack trace ---
at Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.SendRequest()
at Microsoft.TeamFoundation.Client.Channels.TfsHttpRequestChannel.Request(TfsMessage message, TimeSpan timeout)
at Microsoft.TeamFoundation.Client.Channels.TfsHttpClientBase.Invoke(TfsClientOperation operation, Object[] parameters, TimeSpan timeout, Object[]& outputs)
at Microsoft.TeamFoundation.Framework.Client.LocationWebService.Connect(Int32 connectOptions, Int32 lastChangeId, Int32 features)
at Microsoft.TeamFoundation.Framework.Client.FrameworkServerDataProvider.Connect(ConnectOptions connectOptions)
at Microsoft.TeamFoundation.Framework.Client.FrameworkServerDataProvider.EnsureConnected(ConnectOptions optionsNeeded)
at Microsoft.TeamFoundation.Client.TfsConnection.EnsureAuthenticated()
at GitTfs.VsCommon.TfsHelperBase.EnsureAuthenticated() in C:\gittfs\src\GitTfs.VsCommon\TfsHelper.Common.cs:line 91
at GitTfs.Core.GitTfsRemote.EnsureTfsAuthenticated() in C:\gittfs\src\GitTfs\Core\GitTfsRemote.cs:line 83
at GitTfs.Core.GitRepository.ReadAllTfsRemotes() in C:\gittfs\src\GitTfs\Core\GitRepository.cs:line 130
at GitTfs.Commands.Branch.DisplayBranchData() in C:\gittfs\src\GitTfs\Commands\Branch.cs:line 263
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at GitTfs.Util.GitTfsCommandRunner.Run(GitTfsCommand command, IList`1 args) in C:\gittfs\src\GitTfs\Util\GitTfsCommandRunner.cs:line 36
at GitTfs.GitTfs.Main(GitTfsCommand command, IList`1 unparsedArgs) in C:\gittfs\src\GitTfs\GitTfs.cs:line 83
at GitTfs.GitTfs.Run(IList`1 args) in C:\gittfs\src\GitTfs\GitTfs.cs:line 48
at GitTfs.Program.Main(String[] args) in C:\gittfs\src\GitTfs\Program.cs:line 28
2021-03-16 17:25:15.3514 [Error] TF30063: You are not authorized to access https://dev.azure.com/xxxxxxxxx.
2021-03-16 17:25:15.4484 [Error] One or more errors occurred.
2021-03-16 17:25:15.5484 [Error] One or more errors occurred.
2021-03-16 17:25:15.6464 [Error] A task was canceled.
2021-03-16 17:25:15.7454 [Warn] All the logs could be found in the log file: C:\Users\xxxxx\AppData\Local\git-tfs\git-tfs_log.txt
I.e., git tfs branch is not working at all for me.
Issue 3: Missing Assembly? Probably unrelated:
I found this in the log during the process:
2021-03-16 16:35:32.2183 [Debug] Looking for assembly System.Net.Http.Formatting, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 ...
The message was removed after I build the tool myself and copied the .dll from the VS2019 folder of the build.
Issue has been tested both with Git Bash and PowerShell, with git and the git-tfs dir in the Path for the User (but not for System).
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 17 (12 by maintainers)
Commits related to this issue
- Fix #1366 Frequent (and endless) login requests with dev.azure.com — committed to camilohe/git-tfs by deleted user 3 years ago
Merged in master but not released in a version. You will have to build your own version or take the artifact of the in development version published here: https://ci.appveyor.com/project/pmiossec/git-tfs-v2qcm/builds/43346532/artifacts
Indeed, that’s what my initial idea was how it should be. But I don’t know the project well enough to judge whether there are blockers or drawbacks. In any case, this sounds like substantial moving-around of stuff in the code.
Of course not. This is just a workaround that allows me to use this tool in my environment until a proper solution is found. This should be solved properly by sharing the authentication state per unique resource. (However, I’m not quite sure what will happen then if a user does not have read access to all branches of a single project …)
I looked into this and System.Net.Http.Formatting.dll is explicitly not copied to the final
C:\DevGit\git-tfs\src\GitTfs\bin\Debug\net472\GitTfs.Vs2019
by intention. See https://github.com/git-tfs/git-tfs/blob/master/src/build/files_to_ignore_during_post_build_copy.txt which contains all the DLLs which are explictely not copied.Here is the corresponding logic using that file to exclude the files: https://github.com/git-tfs/git-tfs/blob/d25835b143f46f82e586cb501d17a7f10eb3416c/src/GitTfs.Vs2019/GitTfs.Vs2019.csproj#L42-L45
So to sum this up, I think it should be ok that it is missing. I actually mixed this up with some private changes I have locally where I actually introduced usages of that file, that is why I was nervous. But AFAIK it shouldn’t be needed.
I pass that along to @spraints and @pmiossec and all the other contributers, as I have started just recently as a maintainer 😉