Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Keep being re-prompted for credentials #853

Closed
kentcb opened this issue Jun 11, 2019 · 8 comments
Closed

Keep being re-prompted for credentials #853

kentcb opened this issue Jun 11, 2019 · 8 comments
Labels
github Related to GitHub hosting or GitHub Desktop.

Comments

@kentcb
Copy link

kentcb commented Jun 11, 2019

Which Version of GCM are you using ?
1.18.3

Which service are you trying to connect to
GitHub

Expected behavior
Not be prompted for credentials more than once.

Actual behavior
I am prompted for credentials often. Not every time, mind you. But at least several times a day. I mean, look at this madness:

image

It seems to be particularly exacerbated by switching between different repositories, but even if I stick to one it will re-prompt me for credentials soon enough.

I have already set git config --global credential.writelog true and trapped the problem. However, the credential.log file is completely empty.

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

14:41:43.252574 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
14:41:43.256574 git.c:418               trace: built-in: git pull
14:41:43.260576 run-command.c:643       trace: run_command: git fetch --update-head-ok
14:41:43.281572 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:41:43.284576 git.c:418               trace: built-in: git fetch --update-head-ok
14:41:43.290575 run-command.c:643       trace: run_command: GIT_DIR=.git git remote-https origin https://github.com/kentcb/<<redacted>>.git
14:41:43.312579 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:41:43.316578 git.c:675               trace: exec: git-remote-https origin https://github.com/kentcb/<<redacted>>.git
14:41:43.316578 run-command.c:643       trace: run_command: git-remote-https origin https://github.com/kentcb/<<redacted>>.git
14:41:43.343580 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:41:44.098659 run-command.c:643       trace: run_command: 'git credential-manager get'
14:41:44.160657 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:41:44.162659 git.c:675               trace: exec: git-credential-manager get
14:41:44.162659 run-command.c:643       trace: run_command: git-credential-manager get
14:41:44.257654 ...\Common.cs:744       trace: [Main] git-credential-manager (v1.18.3) 'get'
14:41:44.333656 ...\Git\Where.cs:348    trace: [FindGitInstallations] found 1 Git installation(s).
14:41:44.340687 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 50 entries.
14:41:44.347653 ...\Common.cs:505       trace: [LoadOperationArguments] writeLog = 'True'.
14:41:44.348653 ...\Common.cs:318       trace: [EnableTraceLogging] trace logging enabled.
14:41:44.350656 ...\Common.cs:323       trace: [EnableTraceLogging] git local config found at 'C:\Users\Kent\Repository\<<redacted>>\.git\config'.
14:41:44.352656 ...\Common.cs:378       trace: [EnableTraceLoggingFile] trace log destination is 'C:\Users\Kent\Repository\<<redacted>>\.git'.
14:41:44.416660 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://github.com/'.
14:41:44.435658 ...uthentication.cs:151 trace: [GetAuthentication] created GitHub authentication for 'https://github.com/'.
14:41:44.436657 ...\Common.cs:176       trace: [CreateAuthentication] authority for 'https://github.com/' is GitHub.
14:41:44.437655 ...\Common.cs:765       trace: [QueryCredentials] querying 'GitHub' for credentials.
14:41:44.482687 ...icationPrompts.cs:50 trace: [CredentialModalPrompt] prompting user for credentials for 'https://github.com/'.
14:44:30.331356 ...\Authority.cs:101    trace: [AcquireToken] server responded with Unauthorized.
14:44:30.349351 ...\Authority.cs:139    trace: [AcquireToken] two-factor app authentication code required for 'https://github.com/'.
14:44:30.370399 ...icationPrompts.cs:64 trace: [AuthenticationCodeModalPrompt] prompting user for authentication code for 'https://github.com/'.
14:44:35.888329 ...\Authority.cs:101    trace: [AcquireToken] server responded with Created.
14:44:35.890325 ...\Authority.cs:125    trace: [AcquireToken] authentication success: new personal access token for 'https://github.com/' created.
14:44:35.891327 ...uthentication.cs:219 trace: [InteractiveLogon] token acquisition for 'https://github.com/' succeeded.
14:44:37.211405 ...\Authority.cs:200    trace: [ValidateCredentials] credential validation for 'https://github.com/' succeeded.
14:44:37.214393 ...\Common.cs:873       trace: [QueryCredentials] credentials for 'https://github.com/' found.
14:44:37.225354 ...\Common.cs:709       trace: [LogEvent] GitHub credentials for 'https://github.com/' successfully retrieved.
14:44:38.698350 run-command.c:643       trace: run_command: 'git credential-manager store'
14:44:38.764364 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:44:38.766329 git.c:675               trace: exec: git-credential-manager store
14:44:38.766329 run-command.c:643       trace: run_command: git-credential-manager store
14:44:38.852327 ...\Common.cs:744       trace: [Main] git-credential-manager (v1.18.3) 'store'
14:44:38.927327 ...\Git\Where.cs:348    trace: [FindGitInstallations] found 1 Git installation(s).
14:44:38.933326 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 50 entries.
14:44:38.937358 ...\Common.cs:505       trace: [LoadOperationArguments] writeLog = 'True'.
14:44:38.939361 ...\Common.cs:318       trace: [EnableTraceLogging] trace logging enabled.
14:44:38.940321 ...\Common.cs:323       trace: [EnableTraceLogging] git local config found at 'C:\Users\Kent\Repository\<<redacted>>\.git\config'.
14:44:38.942322 ...\Common.cs:378       trace: [EnableTraceLoggingFile] trace log destination is 'C:\Users\Kent\Repository\<<redacted>>\.git'.
14:44:38.978326 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://[email protected]/'.
14:44:38.995321 ...uthentication.cs:151 trace: [GetAuthentication] created GitHub authentication for 'https://[email protected]/'.
14:44:38.996324 ...\Common.cs:176       trace: [CreateAuthentication] authority for 'https://[email protected]/' is GitHub.
14:44:38.997325 ...\Program.cs:526      trace: [Store] storing GitHub credentials for 'https://[email protected]/'.
14:44:39.095320 run-command.c:643       trace: run_command: git fetch-pack --stateless-rpc --stdin --lock-pack --include-tag --thin https://github.com/kentcb/<<redacted>>.git/
14:44:39.113321 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:44:39.116323 git.c:418               trace: built-in: git fetch-pack --stateless-rpc --stdin --lock-pack --include-tag --thin https://github.com/kentcb/<<redacted>>.git/
remote: Enumerating objects: 2, done.
remote: Counting objects: 100% (2/2), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 2 (delta 0), reused 0 (delta 0), pack-reused 0
14:44:39.940603 run-command.c:643       trace: run_command: git unpack-objects --pack_header=2,2
14:44:39.958321 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:44:39.960323 git.c:418               trace: built-in: git unpack-objects --pack_header=2,2
Unpacking objects: 100% (2/2), done.
14:44:39.988321 run-command.c:643       trace: run_command: git rev-list --objects --stdin --not --all --quiet
14:44:40.003323 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:44:40.005324 git.c:418               trace: built-in: git rev-list --objects --stdin --not --all --quiet
From https://github.com/kentcb/<<redacted>>
   0e377c3..3e0e3a2  master        -> origin/master
 * [new tag]         v0.1.0.2-test -> v0.1.0.2-test
 * [new tag]         v0.1.0.8      -> v0.1.0.8
14:44:40.059327 run-command.c:1577      run_processes_parallel: preparing to run up to 1 tasks
14:44:40.059327 run-command.c:1609      run_processes_parallel: done
14:44:40.059327 run-command.c:643       trace: run_command: git gc --auto
14:44:40.076322 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:44:40.078324 git.c:418               trace: built-in: git gc --auto
14:44:40.093323 run-command.c:643       trace: run_command: git merge FETCH_HEAD
14:44:40.110328 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:44:40.112324 git.c:418               trace: built-in: git merge FETCH_HEAD
14:44:40.156323 run-command.c:643       trace: run_command: git gc --auto
Updating 0e377c3..3e0e3a2
Fast-forward
14:44:40.173320 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:44:40.175323 git.c:418               trace: built-in: git gc --auto
@derrickstolee
Copy link

Hi @kentcb. Have you tried upgrading to 1.19?

@kentcb
Copy link
Author

kentcb commented Jun 12, 2019

@derrickstolee I've just upgraded both git4win and GCMW. That said, it was working perfectly well for a very long time before it suddenly started to frequently prompt me for credentials. Will report back to this issue once I have more data.

@derrickstolee
Copy link

Thanks, @kentcb. If it changed without you updating your software, then it is probably due to a server-side change and you can consult GitHub support for more assistance.

@kentcb
Copy link
Author

kentcb commented Jun 15, 2019

I was just prompted for credentials again. Here's the trace:

❯ git push
16:55:53.738903 exec-cmd.c:238          trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
16:55:53.740904 git.c:439               trace: built-in: git push
16:55:53.741902 run-command.c:663       trace: run_command: GIT_DIR=.git git remote-https origin https://github.com/kentcb/<<redacted>>.git
16:55:53.756902 exec-cmd.c:238          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
16:55:53.758902 git.c:704               trace: exec: git-remote-https origin https://github.com/kentcb/<<redacted>>.git
16:55:53.758902 run-command.c:663       trace: run_command: git-remote-https origin https://github.com/kentcb/<<redacted>>.git
16:55:53.778903 exec-cmd.c:238          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
16:55:54.528912 run-command.c:663       trace: run_command: 'git credential-manager get'
16:55:54.617947 exec-cmd.c:238          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
16:55:54.620948 git.c:704               trace: exec: git-credential-manager get
16:55:54.620948 run-command.c:663       trace: run_command: git-credential-manager get
16:55:54.704949 ...\Common.cs:744       trace: [Main] git-credential-manager (v1.18.5) 'get'
16:55:54.770981 ...\Git\Where.cs:348    trace: [FindGitInstallations] found 1 Git installation(s).
16:55:54.776949 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 53 entries.
16:55:54.781946 ...\Common.cs:505       trace: [LoadOperationArguments] writeLog = 'True'.
16:55:54.783947 ...\Common.cs:318       trace: [EnableTraceLogging] trace logging enabled.
16:55:54.784947 ...\Common.cs:323       trace: [EnableTraceLogging] git local config found at 'C:\Users\Kent\Repository\<<redacted>>\.git\config'.
16:55:54.786948 ...\Common.cs:378       trace: [EnableTraceLoggingFile] trace log destination is 'C:\Users\Kent\Repository\<<redacted>>\.git'.
16:55:54.851948 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://github.com/'.
16:55:54.869948 ...uthentication.cs:151 trace: [GetAuthentication] created GitHub authentication for 'https://github.com/'.
16:55:54.870948 ...\Common.cs:176       trace: [CreateAuthentication] authority for 'https://github.com/' is GitHub.
16:55:54.871951 ...\Common.cs:765       trace: [QueryCredentials] querying 'GitHub' for credentials.
16:55:54.905947 ...icationPrompts.cs:50 trace: [CredentialModalPrompt] prompting user for credentials for 'https://github.com/'.
16:56:13.487589 ...\Authority.cs:101    trace: [AcquireToken] server responded with Unauthorized.
16:56:13.492590 ...\Authority.cs:139    trace: [AcquireToken] two-factor app authentication code required for 'https://github.com/'.
16:56:13.496589 ...icationPrompts.cs:64 trace: [AuthenticationCodeModalPrompt] prompting user for authentication code for 'https://github.com/'.
16:56:18.463610 ...\Authority.cs:101    trace: [AcquireToken] server responded with Created.
16:56:18.469589 ...\Authority.cs:125    trace: [AcquireToken] authentication success: new personal access token for 'https://github.com/' created.
16:56:18.473619 ...uthentication.cs:219 trace: [InteractiveLogon] token acquisition for 'https://github.com/' succeeded.
16:56:19.838605 ...\Authority.cs:200    trace: [ValidateCredentials] credential validation for 'https://github.com/' succeeded.
16:56:19.841605 ...\Common.cs:873       trace: [QueryCredentials] credentials for 'https://github.com/' found.
16:56:19.847599 ...\Common.cs:709       trace: [LogEvent] GitHub credentials for 'https://github.com/' successfully retrieved.
16:56:21.215615 run-command.c:663       trace: run_command: 'git credential-manager store'
16:56:21.301584 exec-cmd.c:238          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
16:56:21.303587 git.c:704               trace: exec: git-credential-manager store
16:56:21.303587 run-command.c:663       trace: run_command: git-credential-manager store
16:56:21.380588 ...\Common.cs:744       trace: [Main] git-credential-manager (v1.18.5) 'store'
16:56:21.442581 ...\Git\Where.cs:348    trace: [FindGitInstallations] found 1 Git installation(s).
16:56:21.448581 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 53 entries.
16:56:21.452621 ...\Common.cs:505       trace: [LoadOperationArguments] writeLog = 'True'.
16:56:21.454585 ...\Common.cs:318       trace: [EnableTraceLogging] trace logging enabled.
16:56:21.456584 ...\Common.cs:323       trace: [EnableTraceLogging] git local config found at 'C:\Users\Kent\Repository\<<redacted>>\.git\config'.
16:56:21.457584 ...\Common.cs:378       trace: [EnableTraceLoggingFile] trace log destination is 'C:\Users\Kent\Repository\<<redacted>>\.git'.
16:56:21.492629 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://[email protected]/'.
16:56:21.510631 ...uthentication.cs:151 trace: [GetAuthentication] created GitHub authentication for 'https://[email protected]/'.
16:56:21.511630 ...\Common.cs:176       trace: [CreateAuthentication] authority for 'https://[email protected]/' is GitHub.
16:56:21.513581 ...\Program.cs:526      trace: [Store] storing GitHub credentials for 'https://[email protected]/'.
16:56:21.550581 run-command.c:663       trace: run_command: 'git credential-manager store'
16:56:21.608581 exec-cmd.c:238          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
16:56:21.611582 git.c:704               trace: exec: git-credential-manager store
16:56:21.611582 run-command.c:663       trace: run_command: git-credential-manager store
16:56:21.691614 ...\Common.cs:744       trace: [Main] git-credential-manager (v1.18.5) 'store'
16:56:21.756610 ...\Git\Where.cs:348    trace: [FindGitInstallations] found 1 Git installation(s).
16:56:21.761581 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 53 entries.
16:56:21.765582 ...\Common.cs:505       trace: [LoadOperationArguments] writeLog = 'True'.
16:56:21.767611 ...\Common.cs:318       trace: [EnableTraceLogging] trace logging enabled.
16:56:21.768583 ...\Common.cs:323       trace: [EnableTraceLogging] git local config found at 'C:\Users\Kent\Repository\<<redacted>>\.git\config'.
16:56:21.769582 ...\Common.cs:378       trace: [EnableTraceLoggingFile] trace log destination is 'C:\Users\Kent\Repository\<<redacted>>\.git'.
16:56:21.801621 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://[email protected]/'.
16:56:21.819635 ...uthentication.cs:151 trace: [GetAuthentication] created GitHub authentication for 'https://[email protected]/'.
16:56:21.820588 ...\Common.cs:176       trace: [CreateAuthentication] authority for 'https://[email protected]/' is GitHub.
16:56:21.821584 ...\Program.cs:526      trace: [Store] storing GitHub credentials for 'https://[email protected]/'.
16:56:21.860617 run-command.c:663       trace: run_command: git send-pack --stateless-rpc --helper-status --thin --progress https://github.com/kentcb/<<redacted>>.git/ --stdin
16:56:21.877581 exec-cmd.c:238          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
16:56:21.880615 git.c:439               trace: built-in: git send-pack --stateless-rpc --helper-status --thin --progress https://github.com/kentcb/<<redacted>>.git/ --stdin
16:56:21.891582 run-command.c:663       trace: run_command: git pack-objects --all-progress-implied --revs --stdout --thin --delta-base-offset --progress
16:56:21.907614 exec-cmd.c:238          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
16:56:21.910584 git.c:439               trace: built-in: git pack-objects --all-progress-implied --revs --stdout --thin --delta-base-offset --progress
Enumerating objects: 14, done.
Counting objects: 100% (14/14), done.
Delta compression using up to 8 threads
Compressing objects: 100% (8/8), done.
Writing objects: 100% (8/8), 897 bytes | 448.00 KiB/s, done.
Total 8 (delta 5), reused 0 (delta 0)
remote: Resolving deltas: 100% (5/5), completed with 5 local objects.

@mjcheetham
Copy link
Member

mjcheetham commented Jul 1, 2019

Hey @kentcb, when you say..

It seems to be particularly exacerbated by switching between different repositories, but even if I stick to one it will re-prompt me for credentials soon enough.

..do you have multiple GitHub accounts that the different repositories might have or not-have access to?

Are you also using any of the Git or GitHub features in Visual Studio, or the GitHub desktop client app at the same time?

@kentcb
Copy link
Author

kentcb commented Jul 1, 2019

@mjcheetham No to all your questions. But I haven't actually experienced this problem again since my above post. i.e. it only happened once and not since :/

I will set myself a reminder for two weeks. If I haven't seen this problem again in that time, I'll gladly close the issue.

@mjcheetham
Copy link
Member

@kentcb thanks for the reply!

Looking at the traces you captured I don't see anything obviously going wrong; no errors etc.

One strange thing I do see is that Git appears to be asking GCM to store the successfully validated PAT twice. You can see this line two times in the trace:

run-command.c:663       trace: run_command: git-credential-manager store

It could be that (for some reason) GCM is being asked to store twice from two separate Git processes (hence the question about using other Git tools) and we're walking over ourselves trying to store the PAT. This feels unlikely however, because I'd expect the other would-be process to be writing more information to the trace log.

Please let us know if you hit this again.

@mjcheetham mjcheetham added the github Related to GitHub hosting or GitHub Desktop. label Jul 1, 2019
@kentcb
Copy link
Author

kentcb commented Jul 14, 2019

Haven't hit this since my comment above, so closing for now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
github Related to GitHub hosting or GitHub Desktop.
Projects
None yet
Development

No branches or pull requests

3 participants