Skip to content

git-credential-manager prompting to auth with GitHub when running git git fetch #2194

@ssmith-bread

Description

@ssmith-bread

Version

2.6.1+786ab03440ddc82e807a97c0e540f5247e44cec6

Operating system

Windows

OS version or distribution

OS Name Microsoft Windows 11 Enterprise

Git hosting provider(s)

GitHub

Other hosting provider

No response

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

None

Can you access the remote repository directly in the browser?

Yes, I can access the repository

Expected behavior

git fetch uses stored credentials and succeeds without requiring authentication

Actual behavior

git fetch prompts to sign-in to GitHub by launching a browser window

Image

Logs

Additional Details

Disabling GitHub account filtering succeeds

See trace below

credential-manager get details

Using strace in WSL I was able to determine that the following input is provided to credential manager:

protocol=https
host=github.com
path=Bread-Financial/aws-tfcmgr.git
wwwauth[]=Basic realm="GitHub"

Passing this input to credential-manager get does not find the stored creds:

a813642@BFHJX92KC4 MINGW64 ~/code/aws-tfcmgr (main)
$  echo -e "protocol=https\nhost=github.com\npath=Bread-Financial/aws-tfcmgr.git\nwwwauth[]=Basic realm=\"GitHub\"\n" | git credential-manager get
fatal: User cancelled dialog.

a813642@BFHJX92KC4 MINGW64 ~/code/aws-tfcmgr (main)

Slight variants on the input do find the stored credentials:

  1. Removing the " around GitHub succeeds
a813642@BFHJX92KC4 MINGW64 ~/code/aws-tfcmgr (main)
$  echo -e "protocol=https\nhost=github.com\npath=Bread-Financial/aws-tfcmgr.git\nwwwauth[]=Basic realm=GitHub\n" | git credential-manager get
protocol=https
host=github.com
path=Bread-Financial/aws-tfcmgr.git
REDACTED_AUTH_INFO
  1. Removing wwwauth entirely succeeds
a813642@BFHJX92KC4 MINGW64 ~/code/aws-tfcmgr (main)
$  echo -e "protocol=https\nhost=github.com\npath=Bread-Financial/aws-tfcmgr.git\n" | git credential-manager get
protocol=https
host=github.com
path=Bread-Financial/aws-tfcmgr.git
REDACTED_AUTH_INFO

Failing Trace

a813642@BFHJX92KC4 MINGW64 ~/code/aws-tfcmgr (main)
$ GCM_TRACE=1 GIT_TRACE=1 git fetch
06:51:13.402547 exec-cmd.c:266          trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
06:51:13.418254 git.c:502               trace: built-in: git fetch
06:51:13.436388 run-command.c:674       trace: run_command: GIT_DIR=.git git remote-https origin https://github.com/Bread-Financial/aws-tfcmgr.git
06:51:13.436388 run-command.c:935       trace: start_command: git remote-https origin https://github.com/Bread-Financial/aws-tfcmgr.git
06:51:13.466104 exec-cmd.c:266          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
06:51:13.481853 git.c:809               trace: exec: git-remote-https origin https://github.com/Bread-Financial/aws-tfcmgr.git
06:51:13.481853 run-command.c:674       trace: run_command: git-remote-https origin https://github.com/Bread-Financial/aws-tfcmgr.git
06:51:13.481853 run-command.c:935       trace: start_command: git-remote-https origin https://github.com/Bread-Financial/aws-tfcmgr.git
06:51:13.529404 exec-cmd.c:266          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
06:51:13.863323 run-command.c:674       trace: run_command: 'git credential-manager get'
06:51:13.863323 run-command.c:935       trace: start_command: 'C:/Program Files/Git/usr/bin/sh.exe' -c 'git credential-manager get' 'git credential-manager get'
06:51:13.973437 exec-cmd.c:266          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
06:51:13.989484 git.c:809               trace: exec: git-credential-manager get
06:51:13.989484 run-command.c:674       trace: run_command: git-credential-manager get
06:51:13.989484 run-command.c:935       trace: start_command: git-credential-manager get
06:51:14.147672 exec-cmd.c:266          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
06:51:14.163782 git.c:502               trace: built-in: git config --null --list
06:51:14.227392 ...\Application.cs:106  trace: [RunInternalAsync] Version: 2.6.1.0
06:51:14.227392 ...\Application.cs:107  trace: [RunInternalAsync] Runtime: .NET Framework 4.8.9310.0
06:51:14.227392 ...\Application.cs:108  trace: [RunInternalAsync] Platform: Windows (x86-64)
06:51:14.227392 ...\Application.cs:109  trace: [RunInternalAsync] OSVersion: 10.0 (build 26100)
06:51:14.227392 ...\Application.cs:110  trace: [RunInternalAsync] AppPath: C:\Program Files\Git\mingw64\bin\git-credential-manager.exe
06:51:14.227392 ...\Application.cs:111  trace: [RunInternalAsync] InstallDir: C:\Program Files\Git\mingw64\bin\
06:51:14.227392 ...\Application.cs:112  trace: [RunInternalAsync] Arguments: get
06:51:14.244080 ...GitCommandBase.cs:32 trace: [ExecuteAsync] Start 'get' command...
06:51:14.258833 ...GitCommandBase.cs:46 trace: [ExecuteAsync] Detecting host provider for input:
06:51:14.258833 ...GitCommandBase.cs:47 trace: [ExecuteAsync]   capability[]=authtype
06:51:14.258833 ...GitCommandBase.cs:47 trace: [ExecuteAsync]   capability[]=state
06:51:14.258833 ...GitCommandBase.cs:47 trace: [ExecuteAsync]   protocol=https
06:51:14.258833 ...GitCommandBase.cs:47 trace: [ExecuteAsync]   host=github.com
06:51:14.258833 ...GitCommandBase.cs:47 trace: [ExecuteAsync]   path=Bread-Financial/aws-tfcmgr.git
06:51:14.258833 ...GitCommandBase.cs:47 trace: [ExecuteAsync]   wwwauth=Basic realm="GitHub"
06:51:14.258833 ...viderRegistry.cs:149 trace: [GetProviderAsync] Performing auto-detection of host provider.
06:51:14.258833 ...viderRegistry.cs:162 trace: [GetProviderAsync] Auto-detect probe timeout is 2 ms.
06:51:14.258833 ...viderRegistry.cs:170 trace: [GetProviderAsync] Checking against 4 host providers registered with priority 'Normal'.
06:51:14.258833 ...GitCommandBase.cs:49 trace: [ExecuteAsync] Host provider 'GitHub' was selected.
06:51:14.274707 ...bHostProvider.cs:142 trace: [GetCredentialAsync] Found 1 accounts in the store for service=https://github.com/Bread-Financial/aws-tfcmgr.git:
06:51:14.274707 ...bHostProvider.cs:145 trace: [GetCredentialAsync]   Stephen-Smith_bfh
06:51:14.274707 ...bHostProvider.cs:218 trace: [FilterAccounts] Account filtering is enabled.
06:51:14.274707 ...bHostProvider.cs:226 trace: [FilterAccounts] Filtering based on WWW-Authenticate header information...
06:51:14.274707 ...bHostProvider.cs:229 trace: [FilterAccounts] Matched 0 accounts with public domain:
06:51:14.274707 ...bHostProvider.cs:181 trace: [GetCredentialAsync] No existing credentials found.
06:51:14.274707 ...bHostProvider.cs:184 trace: [GetCredentialAsync] Creating new credential...
06:51:14.274707 ...bHostProvider.cs:423 trace: [GetSupportedAuthenticationModesAsync] https://github.com/Bread-Financial/aws-tfcmgr.git is github.com - authentication schemes: 'Pat, OAuth'
06:51:14.322049 exec-cmd.c:266          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
06:51:14.322049 git.c:502               trace: built-in: git version
06:51:14.369678 exec-cmd.c:266          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
06:51:14.369678 git.c:502               trace: built-in: git config --null --type=path credential.https://github.com/Bread-Financial/aws-tfcmgr.git.gitHubHelper
06:51:14.417096 exec-cmd.c:266          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
06:51:14.417096 git.c:502               trace: built-in: git config --null --type=path credential.github.com/Bread-Financial/aws-tfcmgr.git.gitHubHelper
06:51:14.464758 exec-cmd.c:266          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
06:51:14.464758 git.c:502               trace: built-in: git config --null --type=path credential.https://github.com/Bread-Financial.gitHubHelper
06:51:14.512009 exec-cmd.c:266          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
06:51:14.512009 git.c:502               trace: built-in: git config --null --type=path credential.github.com/Bread-Financial.gitHubHelper
06:51:14.559823 exec-cmd.c:266          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
06:51:14.559823 git.c:502               trace: built-in: git config --null --type=path credential.https://github.com.gitHubHelper
06:51:14.607537 exec-cmd.c:266          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
06:51:14.607537 git.c:502               trace: built-in: git config --null --type=path credential.github.com.gitHubHelper
06:51:14.655164 exec-cmd.c:266          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
06:51:14.670887 git.c:502               trace: built-in: git config --null --type=path credential.gitHubHelper


a813642@BFHJX92KC4 MINGW64 ~/code/aws-tfcmgr (main)

(I entered CTRL-c when prompted to authenticate above)

Disabling account filtering succeeds trace

a813642@BFHJX92KC4 MINGW64 ~/code/aws-tfcmgr (main)
$ GCM_GITHUB_ACCOUNTFILTERING=false GCM_TRACE=1 GIT_TRACE=1 git fetch
06:48:32.751362 exec-cmd.c:266          trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
06:48:32.767285 git.c:502               trace: built-in: git fetch
06:48:32.783198 run-command.c:674       trace: run_command: GIT_DIR=.git git remote-https origin https://github.com/Bread-Financial/aws-tfcmgr.git
06:48:32.783198 run-command.c:935       trace: start_command: git remote-https origin https://github.com/Bread-Financial/aws-tfcmgr.git
06:48:32.815068 exec-cmd.c:266          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
06:48:32.830721 git.c:809               trace: exec: git-remote-https origin https://github.com/Bread-Financial/aws-tfcmgr.git
06:48:32.830721 run-command.c:674       trace: run_command: git-remote-https origin https://github.com/Bread-Financial/aws-tfcmgr.git
06:48:32.830721 run-command.c:935       trace: start_command: git-remote-https origin https://github.com/Bread-Financial/aws-tfcmgr.git
06:48:32.862528 exec-cmd.c:266          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
06:48:33.150462 run-command.c:674       trace: run_command: 'git credential-manager get'
06:48:33.150462 run-command.c:935       trace: start_command: 'C:/Program Files/Git/usr/bin/sh.exe' -c 'git credential-manager get' 'git credential-manager get'
06:48:33.355710 exec-cmd.c:266          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
06:48:33.371359 git.c:809               trace: exec: git-credential-manager get
06:48:33.371359 run-command.c:674       trace: run_command: git-credential-manager get
06:48:33.371359 run-command.c:935       trace: start_command: git-credential-manager get
06:48:33.531634 exec-cmd.c:266          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
06:48:33.546415 git.c:502               trace: built-in: git config --null --list
06:48:33.594129 ...\Application.cs:106  trace: [RunInternalAsync] Version: 2.6.1.0
06:48:33.594129 ...\Application.cs:107  trace: [RunInternalAsync] Runtime: .NET Framework 4.8.9310.0
06:48:33.594129 ...\Application.cs:108  trace: [RunInternalAsync] Platform: Windows (x86-64)
06:48:33.594129 ...\Application.cs:109  trace: [RunInternalAsync] OSVersion: 10.0 (build 26100)
06:48:33.594129 ...\Application.cs:110  trace: [RunInternalAsync] AppPath: C:\Program Files\Git\mingw64\bin\git-credential-manager.exe
06:48:33.594129 ...\Application.cs:111  trace: [RunInternalAsync] InstallDir: C:\Program Files\Git\mingw64\bin\
06:48:33.594129 ...\Application.cs:112  trace: [RunInternalAsync] Arguments: get
06:48:33.629130 ...GitCommandBase.cs:32 trace: [ExecuteAsync] Start 'get' command...
06:48:33.629130 ...GitCommandBase.cs:46 trace: [ExecuteAsync] Detecting host provider for input:
06:48:33.641876 ...GitCommandBase.cs:47 trace: [ExecuteAsync]   capability[]=authtype
06:48:33.641876 ...GitCommandBase.cs:47 trace: [ExecuteAsync]   capability[]=state
06:48:33.641876 ...GitCommandBase.cs:47 trace: [ExecuteAsync]   protocol=https
06:48:33.641876 ...GitCommandBase.cs:47 trace: [ExecuteAsync]   host=github.com
06:48:33.641876 ...GitCommandBase.cs:47 trace: [ExecuteAsync]   path=Bread-Financial/aws-tfcmgr.git
06:48:33.641876 ...GitCommandBase.cs:47 trace: [ExecuteAsync]   wwwauth=Basic realm="GitHub"
06:48:33.643895 ...viderRegistry.cs:149 trace: [GetProviderAsync] Performing auto-detection of host provider.
06:48:33.643895 ...viderRegistry.cs:162 trace: [GetProviderAsync] Auto-detect probe timeout is 2 ms.
06:48:33.645913 ...viderRegistry.cs:170 trace: [GetProviderAsync] Checking against 4 host providers registered with priority 'Normal'.
06:48:33.645913 ...GitCommandBase.cs:49 trace: [ExecuteAsync] Host provider 'GitHub' was selected.
06:48:33.651953 ...bHostProvider.cs:142 trace: [GetCredentialAsync] Found 1 accounts in the store for service=https://github.com/Bread-Financial/aws-tfcmgr.git:
06:48:33.651953 ...bHostProvider.cs:145 trace: [GetCredentialAsync]   Stephen-Smith_bfh
06:48:33.653973 ...bHostProvider.cs:214 trace: [FilterAccounts] Account filtering is disabled.
06:48:33.653973 ...bHostProvider.cs:153 trace: [GetCredentialAsync] Only one account available - using that one!
06:48:33.653973 ...bHostProvider.cs:175 trace: [GetCredentialAsync] Looking for existing credential in store with service=https://github.com/Bread-Financial/aws-tfcmgr.git account=Stephen-Smith_bfh...
06:48:33.653973 ...bHostProvider.cs:190 trace: [GetCredentialAsync] Existing credential found.
06:48:33.653973 ...\GetCommand.cs:39    trace: [ExecuteInternalAsync] Writing credentials to output:
06:48:33.653973 ...\GetCommand.cs:40    trace: [ExecuteInternalAsync]   protocol=https
06:48:33.653973 ...\GetCommand.cs:40    trace: [ExecuteInternalAsync]   host=github.com
06:48:33.653973 ...\GetCommand.cs:40    trace: [ExecuteInternalAsync]   path=Bread-Financial/aws-tfcmgr.git
06:48:33.653973 ...\GetCommand.cs:40    trace: [ExecuteInternalAsync]   username=Stephen-Smith_bfh
06:48:33.655990 ...\GetCommand.cs:40    trace: [ExecuteInternalAsync]   password=********
06:48:33.655990 ...GitCommandBase.cs:53 trace: [ExecuteAsync] End 'get' command...
06:48:33.752685 run-command.c:674       trace: run_command: 'git credential-manager store'
06:48:33.752685 run-command.c:935       trace: start_command: 'C:/Program Files/Git/usr/bin/sh.exe' -c 'git credential-manager store' 'git credential-manager store'
06:48:33.863357 exec-cmd.c:266          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
06:48:33.879037 git.c:809               trace: exec: git-credential-manager store
06:48:33.879037 run-command.c:674       trace: run_command: git-credential-manager store
06:48:33.879037 run-command.c:935       trace: start_command: git-credential-manager store
06:48:34.037252 exec-cmd.c:266          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
06:48:34.050992 git.c:502               trace: built-in: git config --null --list
06:48:34.105969 ...\Application.cs:106  trace: [RunInternalAsync] Version: 2.6.1.0
06:48:34.105969 ...\Application.cs:107  trace: [RunInternalAsync] Runtime: .NET Framework 4.8.9310.0
06:48:34.105969 ...\Application.cs:108  trace: [RunInternalAsync] Platform: Windows (x86-64)
06:48:34.105969 ...\Application.cs:109  trace: [RunInternalAsync] OSVersion: 10.0 (build 26100)
06:48:34.105969 ...\Application.cs:110  trace: [RunInternalAsync] AppPath: C:\Program Files\Git\mingw64\bin\git-credential-manager.exe
06:48:34.105969 ...\Application.cs:111  trace: [RunInternalAsync] InstallDir: C:\Program Files\Git\mingw64\bin\
06:48:34.105969 ...\Application.cs:112  trace: [RunInternalAsync] Arguments: store
06:48:34.129728 ...GitCommandBase.cs:32 trace: [ExecuteAsync] Start 'store' command...
06:48:34.131754 ...GitCommandBase.cs:46 trace: [ExecuteAsync] Detecting host provider for input:
06:48:34.131754 ...GitCommandBase.cs:47 trace: [ExecuteAsync]   protocol=https
06:48:34.131754 ...GitCommandBase.cs:47 trace: [ExecuteAsync]   host=github.com
06:48:34.131754 ...GitCommandBase.cs:47 trace: [ExecuteAsync]   path=Bread-Financial/aws-tfcmgr.git
06:48:34.131754 ...GitCommandBase.cs:47 trace: [ExecuteAsync]   username=Stephen-Smith_bfh
06:48:34.131754 ...GitCommandBase.cs:47 trace: [ExecuteAsync]   password=********
06:48:34.147458 ...viderRegistry.cs:149 trace: [GetProviderAsync] Performing auto-detection of host provider.
06:48:34.147458 ...viderRegistry.cs:162 trace: [GetProviderAsync] Auto-detect probe timeout is 2 ms.
06:48:34.147458 ...viderRegistry.cs:170 trace: [GetProviderAsync] Checking against 4 host providers registered with priority 'Normal'.
06:48:34.147458 ...GitCommandBase.cs:49 trace: [ExecuteAsync] Host provider 'GitHub' was selected.
06:48:34.147458 ...bHostProvider.cs:257 trace: [StoreCredentialAsync] Storing credential with service=https://github.com/Bread-Financial/aws-tfcmgr.git account=Stephen-Smith_bfh...
06:48:34.147458 ...bHostProvider.cs:259 trace: [StoreCredentialAsync] Credential was successfully stored.
06:48:34.147458 ...GitCommandBase.cs:53 trace: [ExecuteAsync] End 'store' command...
06:48:34.242502 run-command.c:674       trace: run_command: git rev-list --objects --stdin --not --exclude-hidden=fetch --all --quiet --alternate-refs
06:48:34.242502 run-command.c:935       trace: start_command: git rev-list --objects --stdin --not --exclude-hidden=fetch --all --quiet --alternate-refs
06:48:34.321743 run-command.c:1541      run_processes_parallel: preparing to run up to 1 tasks
06:48:34.321743 run-command.c:1569      run_processes_parallel: done
06:48:34.321743 run-command.c:674       trace: run_command: git maintenance run --auto --no-quiet --detach
06:48:34.321743 run-command.c:935       trace: start_command: git maintenance run --auto --no-quiet --detach
06:48:34.363551 exec-cmd.c:266          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
06:48:34.381212 git.c:502               trace: built-in: git maintenance run --auto --no-quiet --detach

Versions

a813642@BFHJX92KC4 MINGW64 ~
$ git --version ; git-credential-manager --version
git version 2.52.0.windows.1
2.6.1+786ab03440ddc82e807a97c0e540f5247e44cec6

Config Settings

a813642@BFHJX92KC4 MINGW64 ~/code/aws-tfcmgr (main)
$ git config --list --show-origin
file:C:/Program Files/Git/etc/gitconfig diff.astextplain.textconv=astextplain
file:C:/Program Files/Git/etc/gitconfig filter.lfs.clean=git-lfs clean -- %f
file:C:/Program Files/Git/etc/gitconfig filter.lfs.smudge=git-lfs smudge -- %f
file:C:/Program Files/Git/etc/gitconfig filter.lfs.process=git-lfs filter-process
file:C:/Program Files/Git/etc/gitconfig filter.lfs.required=true
file:C:/Program Files/Git/etc/gitconfig http.sslbackend=schannel
file:C:/Program Files/Git/etc/gitconfig core.autocrlf=true
file:C:/Program Files/Git/etc/gitconfig core.fscache=true
file:C:/Program Files/Git/etc/gitconfig core.symlinks=false
file:C:/Program Files/Git/etc/gitconfig pull.rebase=false
file:C:/Program Files/Git/etc/gitconfig credential.helper=manager
file:C:/Program Files/Git/etc/gitconfig credential.https://dev.azure.com.usehttppath=true
file:C:/Program Files/Git/etc/gitconfig init.defaultbranch=master
file:C:/Users/a813642/.gitconfig        credential.usehttppath=true
file:C:/Users/a813642/.gitconfig        credential.helperselector.selected=manager
file:.git/config        core.repositoryformatversion=0
file:.git/config        core.filemode=false
file:.git/config        core.bare=false
file:.git/config        core.logallrefupdates=true
file:.git/config        core.symlinks=false
file:.git/config        core.ignorecase=true
file:.git/config        remote.origin.url=https://github.com/Bread-Financial/aws-tfcmgr.git
file:.git/config        remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
file:.git/config        branch.main.remote=origin
file:.git/config        branch.main.merge=refs/heads/main

Metadata

Metadata

Assignees

No one assigned

    Labels

    auth-issueAn issue authenticating to a hosthost:githubSpecific to the GitHub host providerplatform:windowsSpecific to the Windows platform

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions