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.87k stars 589 forks source link

GitHub logon failed with GCM #914

Open ThomsonTan opened 4 years ago

ThomsonTan commented 4 years ago

Which Version of GCM are you using ? 1.20.0 From a command prompt, run git credential-manager version and paste the output.

Which service are you trying to connect to

If AzureDevops Hosted describe your url

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

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 Cannot logon to with my account name/password/pass code. It happened many times, and when it happened, the login may succeed after multiple retries (like more than 10 times of retries).

git push
Logon failed, use ctrl+c to cancel basic credential prompt.

Actual behavior Repeated show login and pass code dialog, and "logon failed" message to console.

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

springcomp commented 3 years ago

I have the same problem. Extract form the logs:

12:58:21.593523 git.c:442               trace: built-in: git push --set-upstream origin main
12:58:21.604160 run-command.c:663       trace: run_command: GIT_DIR=.git git remote-https origin https://github.com/SpringComp/PSReadLine
12:58:21.630072 exec-cmd.c:237          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
12:58:21.635336 git.c:702               trace: exec: git-remote-https origin https://github.com/SpringComp/PSReadLine
12:58:21.635336 run-command.c:663       trace: run_command: git-remote-https origin https://github.com/SpringComp/PSReadLine
12:58:21.663098 exec-cmd.c:237          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
12:58:22.063444 run-command.c:663       trace: run_command: 'git credential-manager get'
12:58:22.226957 exec-cmd.c:237          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
12:58:22.233129 git.c:702               trace: exec: git-credential-manager get
12:58:22.234997 run-command.c:663       trace: run_command: git-credential-manager get
12:58:22.469240 ...\Common.cs:744       trace: [Main] git-credential-manager (v1.20.0) 'get'
12:58:22.610980 ...\Git\Where.cs:348    trace: [FindGitInstallations] found 1 Git installation(s).
12:58:22.620011 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 45 entries.
12:58:22.727706 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://github.com/'.
12:58:22.749051 ...uthentication.cs:151 trace: [GetAuthentication] created GitHub authentication for 'https://github.com/'.
12:58:22.750757 ...\Common.cs:176       trace: [CreateAuthentication] authority for 'https://github.com/' is GitHub.
12:58:22.750757 ...\Common.cs:765       trace: [QueryCredentials] querying 'GitHub' for credentials.
12:58:22.799261 ...icationPrompts.cs:50 trace: [CredentialModalPrompt] prompting user for credentials for 'https://github.com/'.
12:58:54.671193 ...\Authority.cs:101    trace: [AcquireToken] server responded with Unauthorized.
12:58:54.677586 ...\Authority.cs:150    trace: [AcquireToken] authentication failed for 'https://github.com/'.
12:58:54.678675 ...uthentication.cs:235 trace: [InteractiveLogon] interactive logon for 'https://github.com/' failed.
12:58:54.682646 ...\Common.cs:878       trace: [QueryCredentials] credentials for 'https://github.com/' not found.
12:58:54.684366 ...\Common.cs:709       trace: [LogEvent] Failed to retrieve GitHub credentials for 'https://github.com/'.
12:58:55.497856 ...\Common.cs:744       trace: [Main] git-credential-manager (v1.20.0) 'get'
12:58:55.652171 ...\Git\Where.cs:348    trace: [FindGitInstallations] found 1 Git installation(s).
12:58:55.661341 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 45 entries.
12:58:55.758919 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://github.com/'.
12:58:55.788564 ...uthentication.cs:151 trace: [GetAuthentication] created GitHub authentication for 'https://github.com/'.
12:58:55.789441 ...\Common.cs:176       trace: [CreateAuthentication] authority for 'https://github.com/' is GitHub.
12:58:55.789441 ...\Common.cs:765       trace: [QueryCredentials] querying 'GitHub' for credentials.
12:58:55.844393 ...icationPrompts.cs:50 trace: [CredentialModalPrompt] prompting user for credentials for 'https://github.com/'.
13:01:03.730891 ...uthentication.cs:235 trace: [InteractiveLogon] interactive logon for 'https://github.com/' failed.
13:01:03.732912 ...\Common.cs:878       trace: [QueryCredentials] credentials for 'https://github.com/' not found.
13:01:03.735904 ...\Common.cs:709       trace: [LogEvent] Failed to retrieve GitHub credentials for 'https://github.com/'.
13:01:03.743936 ...\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.

Logins are coming from a Password Manager and work successfully after a logout | login in a Web browser.

ThomsonTan commented 3 years ago

@springcomp for my case, I have 2 factors authentication enabled. It worked if I log in with Github PAT instead of password.