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

GCM fails to get the Azure organization name from the URL username #1520

Closed
SpecLad opened this issue Jan 23, 2024 · 1 comment · Fixed by #1522
Closed

GCM fails to get the Azure organization name from the URL username #1520

SpecLad opened this issue Jan 23, 2024 · 1 comment · Fixed by #1522
Labels
auth-issue An issue authenticating to a host bug A bug in Git Credential Manager host:azure-repos Specific to the Azure Repos (Azure DevOps, VSTS) host provider

Comments

@SpecLad
Copy link

SpecLad commented Jan 23, 2024

Version

2.4.1

Operating system

Windows

OS version or distribution

Windows 11 22H2 (x64)

Git hosting provider(s)

Azure DevOps

Other hosting provider

No response

(Azure DevOps only) What format is your remote URL?

https://{org}@dev.azure.com/{org}

Can you access the remote repository directly in the browser?

Yes, I can access the repository

Expected behavior

GCM should open an Azure login dialog.

Actual behavior

GCM outputs the following message:

fatal: Cannot determine the organization name for this 'dev.azure.com' remote URL. Ensure the `credential.useHttpPath` configuration value is set, or set the organization name as the user in the remote URL '{org}@dev.azure.com'.

Logs

> git ls-remote https://[email protected]/redacted/redacted/_git/redacted

01:01:11.347318 exec-cmd.c:244          trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
01:01:11.352318 git.c:463               trace: built-in: git ls-remote https://[email protected]/redacted/redacted/_git/redacted
01:01:11.352318 run-command.c:659       trace: run_command: git remote-https https://[email protected]/redacted/redacted/_git/redacted https://[email protected]/redacted/redacted/_git/redacted
01:01:11.363319 exec-cmd.c:244          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
01:01:11.364320 git.c:749               trace: exec: git-remote-https https://[email protected]/redacted/redacted/_git/redacted https://[email protected]/redacted/redacted/_git/redacted
01:01:11.364320 run-command.c:659       trace: run_command: git-remote-https https://[email protected]/redacted/redacted/_git/redacted https://[email protected]/redacted/redacted/_git/redacted
01:01:11.373799 exec-cmd.c:244          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
01:01:12.613138 run-command.c:659       trace: run_command: 'git credential-manager get'
01:01:12.651673 exec-cmd.c:244          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
01:01:12.653673 git.c:749               trace: exec: git-credential-manager get
01:01:12.653673 run-command.c:659       trace: run_command: git-credential-manager get
01:01:12.718171 exec-cmd.c:244          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
01:01:12.720190 git.c:463               trace: built-in: git config --null --list
01:01:12.768692 ...\Application.cs:106  trace: [RunInternalAsync] Version: 2.4.1.0
01:01:12.777363 ...\Application.cs:107  trace: [RunInternalAsync] Runtime: .NET Framework 4.8.9181.0
01:01:12.777363 ...\Application.cs:108  trace: [RunInternalAsync] Platform: Windows (x86-64)
01:01:12.777363 ...\Application.cs:109  trace: [RunInternalAsync] OSVersion: 10.0 (build 22621)
01:01:12.777363 ...\Application.cs:110  trace: [RunInternalAsync] AppPath: C:\Program Files\Git\mingw64\bin\git-credential-manager.exe
01:01:12.777363 ...\Application.cs:111  trace: [RunInternalAsync] InstallDir: C:\Program Files\Git\mingw64\bin\
01:01:12.777363 ...\Application.cs:112  trace: [RunInternalAsync] Arguments: get
01:01:12.811407 ...GitCommandBase.cs:32 trace: [ExecuteAsync] Start 'get' command...
01:01:12.820436 ...GitCommandBase.cs:46 trace: [ExecuteAsync] Detecting host provider for input:
01:01:12.822433 ...GitCommandBase.cs:47 trace: [ExecuteAsync]   protocol=https
01:01:12.822433 ...GitCommandBase.cs:47 trace: [ExecuteAsync]   host=dev.azure.com
01:01:12.822433 ...GitCommandBase.cs:47 trace: [ExecuteAsync]   username=redacted
01:01:12.822433 ...GitCommandBase.cs:47 trace: [ExecuteAsync]   wwwauth[]=Bearer authorization_uri=https://login.microsoftonline.com/42cc3295-cd0e-449c-b98e-5ce5b560c1d3
01:01:12.822433 ...GitCommandBase.cs:47 trace: [ExecuteAsync]   wwwauth[]=Basic realm="https://tfsprodcus1.app.visualstudio.com/"
01:01:12.823414 ...GitCommandBase.cs:47 trace: [ExecuteAsync]   wwwauth[]=TFS-Federated
01:01:12.826438 ...viderRegistry.cs:149 trace: [GetProviderAsync] Performing auto-detection of host provider.
01:01:12.826438 ...viderRegistry.cs:162 trace: [GetProviderAsync] Auto-detect probe timeout is 2 ms.
01:01:12.827965 ...viderRegistry.cs:170 trace: [GetProviderAsync] Checking against 4 host providers registered with priority 'Normal'.
01:01:12.828995 ...GitCommandBase.cs:49 trace: [ExecuteAsync] Host provider 'Azure Repos' was selected.
fatal: Cannot determine the organization name for this 'dev.azure.com' remote URL. Ensure the `credential.useHttpPath` configuration value is set, or set the organization name as the user in the remote URL '{org}@dev.azure.com'.
   в Microsoft.AzureRepos.UriHelpers.CreateOrganizationUri(Uri remoteUri, String& orgName)
   в Microsoft.AzureRepos.AzureReposHostProvider.GetServiceName(Uri remoteUri)
   в Microsoft.AzureRepos.AzureReposHostProvider.<GetCredentialAsync>d__15.MoveNext()
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   в System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   в GitCredentialManager.Commands.GetCommand.<ExecuteInternalAsync>d__1.MoveNext()
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   в System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   в GitCredentialManager.Commands.GitCommandBase.<ExecuteAsync>d__5.MoveNext()
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   в System.CommandLine.Invocation.AnonymousCommandHandler.<InvokeAsync>d__6.MoveNext()
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   в System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   в System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   в System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass15_0.<<AddMiddleware>b__0>d.MoveNext()
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   в System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext()
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   в System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   в System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass19_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   в System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__18_0>d.MoveNext()
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   в System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseDirective>b__0>d.MoveNext()
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   в System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__5_0>d.MoveNext()
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   в System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<<UseExceptionHandler>b__0>d.MoveNext()
01:01:12.862938 run-command.c:659       trace: run_command: bash -c 'cat >/dev/tty && read -r -s line </dev/tty && echo "$line" && echo >/dev/tty'
Password for 'https://[email protected]':
@SpecLad SpecLad added the auth-issue An issue authenticating to a host label Jan 23, 2024
@SpecLad
Copy link
Author

SpecLad commented Jan 23, 2024

I suspect that the problem is that here:

the includeUser parameter is not set to true.

@mjcheetham mjcheetham added bug A bug in Git Credential Manager host:azure-repos Specific to the Azure Repos (Azure DevOps, VSTS) host provider labels Jan 25, 2024
mjcheetham added a commit that referenced this issue Feb 22, 2024
Fix a bug in the Azure Repos host provider that prevented the Azure
DevOps organisation name from being pulled from the userinfo part of the
remote URL.

When creating the remote URL from Git input in multiple places we had
not been preserving the userinfo part that was subsequently passed to
the `CreateOrganizationUri` helper method to extract the org URL.

Also add an additional test for PAT mode to cover this use case.

Fixes #1520
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth-issue An issue authenticating to a host bug A bug in Git Credential Manager host:azure-repos Specific to the Azure Repos (Azure DevOps, VSTS) host provider
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants