microsoft / Git-Credential-Manager-for-Windows

Secure Git credential storage for Windows with support for Visual Studio Team Services, GitHub, and Bitbucket multi-factor authentication.
Other
2.85k stars 590 forks source link

GCM fails to accept ms account authentication #844

Open tbrentlong opened 5 years ago

tbrentlong commented 5 years ago

Having similar issue to 818 which shows closed about a month ago. Not able to log in with correct creds.

GCM Version: Git Credential Manager for Windows version 1.18.4

Trying to connect to Azure DevOps (https://myOrg.visualstudio.com/projectName/_git/repoName)

If you're using Azure DevOps, can you access the repository in the browser via the same URL? -- YES.

If you're using Azure DevOps, and the account picker shows more than one identity as you authenticate, check that you selected the same one that has access on the web.

Expected behavior I expected it to start cloning the repo after I authenticated.

Actual behavior Cmd prompt states that auth failed, prompts a second time, states that it failed again and then prompts me to enter creds on the command line. See trace below

Set the env variables GCM_TRACE=1 and GIT_TRACE=1 and run your git command. Redact any private information and attach the log

C:\source>git clone https://MYORG.visualstudio.com/MYPROJ/_git/MYREPO 22:03:52.139469 exec-cmd.c:236 trace: resolved executable dir: D:/Program Files/Git/mingw64/bin 22:03:52.140445 git.c:419 trace: built-in: git clone https://MYORG.visualstudio.com/MYPROJ/_git/MYREPO Cloning into 'MYREPO'... 22:03:52.193305 run-command.c:643 trace: run_command: git remote-https origin https://MYORG.visualstudio.com/MYPROJ/_git/MYREPO 22:03:52.217246 exec-cmd.c:236 trace: resolved executable dir: D:/Program Files/Git/mingw64/libexec/git-core 22:03:52.221318 git.c:676 trace: exec: git-remote-https origin https://MYORG.visualstudio.com/MYPROJ/_git/MYREPO 22:03:52.221318 run-command.c:643 trace: run_command: git-remote-https origin https://MYORG.visualstudio.com/MYPROJ/_git/MYREPO 22:03:52.256155 exec-cmd.c:236 trace: resolved executable dir: D:/Program Files/Git/mingw64/libexec/git-core 22:03:52.614181 run-command.c:643 trace: run_command: 'git credential-manager get' 22:03:52.707929 exec-cmd.c:236 trace: resolved executable dir: D:/Program Files/Git/mingw64/libexec/git-core 22:03:52.710920 git.c:676 trace: exec: git-credential-manager get 22:03:52.710920 run-command.c:643 trace: run_command: git-credential-manager get 22:03:52.921357 ...\Common.cs:744 trace: [Main] git-credential-manager (v1.18.4) 'get' 22:03:53.039160 ...\Git\Where.cs:348 trace: [FindGitInstallations] found 1 Git installation(s). 22:03:53.052078 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 13 entries. 22:03:53.063101 ...\Common.cs:543 trace: [LoadOperationArguments] useHttpPath = ''. 22:03:53.141871 ...\Common.cs:85 trace: [CreateAuthentication] detecting authority type for 'https://MYORG.visualstudio.com/MYPROJ/_git/MYREPO'. 22:03:53.692363 ...uthentication.cs:231 trace: [DetectAuthority] detected 'https://MYORG.visualstudio.com/' as Azure DevOps from GET response. 22:03:53.696380 ...uthentication.cs:299 trace: [DetectAuthority] tenant resource for 'https://MYORG.visualstudio.com/' is {00000000000000000000000000000000}. 22:03:53.699344 ...uthentication.cs:362 trace: [GetAuthentication] MSA authority detected. 22:03:53.748258 ...\Common.cs:205 trace: [CreateAuthentication] authority for 'https://MYORG.visualstudio.com/MYPROJ/_git/MYREPO' is Microsoft Live. 22:03:53.750242 ...\Common.cs:765 trace: [QueryCredentials] querying 'MicrosoftAccount' for credentials. 22:04:07.300566 ...\Authority.cs:195 trace: [InteractiveAcquireToken] authority host URL = 'https://login.microsoftonline.com/common', token acquisition for tenant [AGUIDENDINGWITH..e24514] succeeded. 22:04:07.303927 ...Authentication.cs:86 trace: [InteractiveLogon] token 'https://MYORG.visualstudio.com/MYPROJ/_git/MYREPO' successfully acquired. 22:04:08.555308 ...\Authority.cs:375 trace: [GetIdentityServiceUri] failed to find Identity Service for 'https://MYORG.visualstudio.com/_apis/ServiceDefinitions/LocationService2/ANOTHERGUIDENDINGWITH...-E3F0AA25B381?api-version=1.0' via location service [203]. 22:04:08.569263 ...\Authority.cs:136 trace: [GeneratePersonalAccessToken] ! error: 'Failed to find Identity Service for https://MYORG.visualstudio.com/MYPROJ/_git/MYREPO.'. 22:04:08.572224 ...\Authority.cs:139 trace: [GeneratePersonalAccessToken] personal access token acquisition for 'https://MYORG.visualstudio.com/MYPROJ/_git/MYREPO' failed. 22:04:08.579815 ...\Common.cs:854 trace: [QueryCredentials] credentials for 'https://MYORG.visualstudio.com/MYPROJ/_git/MYREPO' not found. 22:04:08.584249 ...\Common.cs:709 trace: [LogEvent] Failed to retrieve Microsoft Live credentials for 'https://MYORG.visualstudio.com/MYPROJ/_git/MYREPO'. 22:04:08.593204 ...\Program.cs:414 trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt. Logon failed, use ctrl+c to cancel basic credential prompt. 22:04:08.702871 run-command.c:643 trace: run_command: 'git credential-manager get' 22:04:08.782692 exec-cmd.c:236 trace: resolved executable dir: D:/Program Files/Git/mingw64/libexec/git-core 22:04:08.786682 git.c:676 trace: exec: git-credential-manager get 22:04:08.786682 run-command.c:643 trace: run_command: git-credential-manager get 22:04:08.994090 ...\Common.cs:744 trace: [Main] git-credential-manager (v1.18.4) 'get' 22:04:09.126782 ...\Git\Where.cs:348 trace: [FindGitInstallations] found 1 Git installation(s). 22:04:09.140699 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 13 entries. 22:04:09.149960 ...\Common.cs:543 trace: [LoadOperationArguments] useHttpPath = ''. 22:04:09.262406 ...\Common.cs:85 trace: [CreateAuthentication] detecting authority type for 'https://MYORG.visualstudio.com/MYPROJ/_git/MYREPO'. 22:04:09.671613 ...uthentication.cs:231 trace: [DetectAuthority] detected 'https://MYORG.visualstudio.com/' as Azure DevOps from GET response. 22:04:09.676315 ...uthentication.cs:299 trace: [DetectAuthority] tenant resource for 'https://MYORG.visualstudio.com/' is {00000000000000000000000000000000}. 22:04:09.679304 ...uthentication.cs:362 trace: [GetAuthentication] MSA authority detected. 22:04:09.746079 ...\Common.cs:205 trace: [CreateAuthentication] authority for 'https://MYORG.visualstudio.com/MYPROJ/_git/MYREPO' is Microsoft Live. 22:04:09.749071 ...\Common.cs:765 trace: [QueryCredentials] querying 'MicrosoftAccount' for credentials. 22:04:19.182635 ...\Authority.cs:195 trace: [InteractiveAcquireToken] authority host URL = 'https://login.microsoftonline.com/common', token acquisition for tenant [AGUIDENDINGWITH..e24514] succeeded. 22:04:19.186623 ...Authentication.cs:86 trace: [InteractiveLogon] token 'https://MYORG.visualstudio.com/MYPROJ/_git/MYREPO' successfully acquired. 22:04:19.732168 ...\Authority.cs:375 trace: [GetIdentityServiceUri] failed to find Identity Service for 'https://MYORG.visualstudio.com/_apis/ServiceDefinitions/LocationService2/ANOTHERGUIDENDINGWITH...-E3F0AA25B381?api-version=1.0' via location service [203]. 22:04:19.737151 ...\Authority.cs:136 trace: [GeneratePersonalAccessToken] ! error: 'Failed to find Identity Service for https://MYORG.visualstudio.com/MYPROJ/_git/MYREPO.'. 22:04:19.739162 ...\Authority.cs:139 trace: [GeneratePersonalAccessToken] personal access token acquisition for 'https://MYORG.visualstudio.com/MYPROJ/_git/MYREPO' failed. 22:04:19.742145 ...\Common.cs:854 trace: [QueryCredentials] credentials for 'https://MYORG.visualstudio.com/MYPROJ/_git/MYREPO' not found. 22:04:19.746128 ...\Common.cs:709 trace: [LogEvent] Failed to retrieve Microsoft Live credentials for 'https://MYORG.visualstudio.com/MYPROJ/_git/MYREPO'. 22:04:19.752308 ...\Program.cs:414 trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt. Logon failed, use ctrl+c to cancel basic credential prompt. 22:04:19.861817 run-command.c:643 trace: run_command: bash -c 'test "a$SHELL" '!'= "a${SHELL%.exe}" || exit 127; cat >/dev/tty && read -r line </dev/tty && echo "$line"' Username for 'https://MYORG.visualstudio.com/MYPROJ/_git/MYREPO':

dscho commented 5 years ago

I wonder whether 1.18.5 works for you: https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases/tag/1.18.5

jeschu1 commented 5 years ago

@tbrentlong did the latest version help?

lvasiliou commented 4 years ago

I am having the same issue since July. Our AAD accounts use MFA, I sign in, authenticate with ms authentication app, prompted a second time then i have to switch to basic auth typing my username and access token as password. This is super annoying.

tbrentlong commented 4 years ago

It works with the newer version and with git version 2.13.3.windows.1

ohadschn commented 4 years ago

I am having the same issue since July. Our AAD accounts use MFA, I sign in, authenticate with ms authentication app, prompted a second time then i have to switch to basic auth typing my username and access token as password. This is super annoying.

I'm getting the same using the latest git for windows (2.25.0.windows.1) and Git Credential Manager for Windows (v1.20). Here's what I tried:

  1. Delete all git credentials from Credential Manager
  2. Sign in with smartcard
  3. Sign in as current user
  4. Sign in with user connected to Windows
  5. Sign in with user/password

Basically nothing works and after two failed attempts I have to use my e-mail + PAT

ohadschn commented 4 years ago

Update - this was my issue: https://github.com/microsoft/Git-Credential-Manager-for-Windows/issues/858#issuecomment-521248756