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

Credential-Manager only works for github if the User name in Windows Credential is everything but the actual github user name #1631

Open
jaatwork opened this issue Jun 5, 2024 · 3 comments
Labels
auth-issue An issue authenticating to a host

Comments

@jaatwork
Copy link

jaatwork commented Jun 5, 2024

Version

2.5.0+d34930736e131ad80e5690e5634ced1808aff3e2

Operating system

Windows

OS version or distribution

10 Pro 19045.4412

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

After installing git for windows on the machine I did a first git clone . This asked me for Authentication via git-credential-manager and stored the credentials in the Windows Credentials.

The next time I did a git fetch (or any other git command that requires authentication) I expected the stored credentials to be used. Especially I expect my actual git User Name to be required.

Actual behavior

I get a git-credential-manager popup every time I interact with github via a git command that requires to be authenticated

Then I found #1555 (comment)

And indeed, changing the User Name in Windows Credentials to "1" lets me run i.e. git pull without getting the git-credential-manager popup

Actually, it seems I can set the User Name to anything as long as it is not my real github username.

Logs

No response

@jaatwork jaatwork added the auth-issue An issue authenticating to a host label Jun 5, 2024
@jaatwork jaatwork changed the title Credential-Manager only works if the User Name in Windows Credential for github is wrong Credential-Manager only works for github if the User name in Windows Credential is everything but the actual github user name Jun 5, 2024
@mjcheetham
Copy link
Collaborator

This is unexpected for GitHub. Are you using GitHub Enterprise Server, or GitHub.com?

Please can you include trace logs, otherwise we will be unable to assist further.

@wjohnsaunders
Copy link

I along with everybody else in my company have the same problem. We use the following fix to work around the issue (that is use wincred instead of manager in git).

git config --global credential.gitHubAccountFiltering false

Here is a trace when it is working while using "1" as the username.

$ git pull
15:42:44.702062 ...\Application.cs:106 trace: [RunInternalAsync] Version: 2.5.1.0
15:42:44.703053 ...\Application.cs:107 trace: [RunInternalAsync] Runtime: .NET Framework 4.8.4712.0
15:42:44.703053 ...\Application.cs:108 trace: [RunInternalAsync] Platform: Windows (x86-64)
15:42:44.703053 ...\Application.cs:109 trace: [RunInternalAsync] OSVersion: 10.0 (build 19045)
15:42:44.703053 ...\Application.cs:110 trace: [RunInternalAsync] AppPath: C:\Program Files\Git\mingw64\bin\git-credential-manager.exe
15:42:44.703053 ...\Application.cs:111 trace: [RunInternalAsync] InstallDir: C:\Program Files\Git\mingw64\bin
15:42:44.703053 ...\Application.cs:112 trace: [RunInternalAsync] Arguments: get
15:42:44.733053 ...GitCommandBase.cs:32 trace: [ExecuteAsync] Start 'get' command...
15:42:44.742053 ...GitCommandBase.cs:46 trace: [ExecuteAsync] Detecting host provider for input:
15:42:44.743021 ...GitCommandBase.cs:47 trace: [ExecuteAsync] capability[]=authtype
15:42:44.743021 ...GitCommandBase.cs:47 trace: [ExecuteAsync] capability[]=state
15:42:44.743021 ...GitCommandBase.cs:47 trace: [ExecuteAsync] protocol=https
15:42:44.743021 ...GitCommandBase.cs:47 trace: [ExecuteAsync] host=github.com
15:42:44.743021 ...GitCommandBase.cs:47 trace: [ExecuteAsync] wwwauth=Basic realm="GitHub"
15:42:44.746053 ...viderRegistry.cs:149 trace: [GetProviderAsync] Performing auto-detection of host provider.
15:42:44.746053 ...viderRegistry.cs:162 trace: [GetProviderAsync] Auto-detect probe timeout is 2 ms.
15:42:44.747053 ...viderRegistry.cs:170 trace: [GetProviderAsync] Checking against 4 host providers registered with priority 'Normal'.
15:42:44.749051 ...GitCommandBase.cs:49 trace: [ExecuteAsync] Host provider 'GitHub' was selected.
15:42:44.756021 ...bHostProvider.cs:142 trace: [GetCredentialAsync] Found 1 accounts in the store for service=https://github.com:
15:42:44.756021 ...bHostProvider.cs:145 trace: [GetCredentialAsync] 1
15:42:44.757021 ...bHostProvider.cs:218 trace: [FilterAccounts] Account filtering is enabled.
15:42:44.760021 ...bHostProvider.cs:226 trace: [FilterAccounts] Filtering based on WWW-Authenticate header information...
15:42:44.761036 ...bHostProvider.cs:229 trace: [FilterAccounts] Matched 1 accounts with public domain:
15:42:44.761036 ...bHostProvider.cs:234 trace: [FilterAccounts] 1
15:42:44.761036 ...bHostProvider.cs:153 trace: [GetCredentialAsync] Only one account available - using that one!
15:42:44.761036 ...bHostProvider.cs:175 trace: [GetCredentialAsync] Looking for existing credential in store with service=https://github.com account=1...
15:42:44.762021 ...bHostProvider.cs:190 trace: [GetCredentialAsync] Existing credential found.
15:42:44.762021 ...\GetCommand.cs:39 trace: [ExecuteInternalAsync] Writing credentials to output:
15:42:44.762021 ...\GetCommand.cs:40 trace: [ExecuteInternalAsync] protocol=https
15:42:44.762021 ...\GetCommand.cs:40 trace: [ExecuteInternalAsync] host=github.com
15:42:44.762021 ...\GetCommand.cs:40 trace: [ExecuteInternalAsync] username=1
15:42:44.762021 ...\GetCommand.cs:40 trace: [ExecuteInternalAsync] password=********
15:42:44.763024 ...GitCommandBase.cs:53 trace: [ExecuteAsync] End 'get' command...

Here is a trace when it fails while using the real username.

$ git pull
15:44:19.056081 ...\Application.cs:106 trace: [RunInternalAsync] Version: 2.5.1.0
15:44:19.057083 ...\Application.cs:107 trace: [RunInternalAsync] Runtime: .NET Framework 4.8.4712.0
15:44:19.057083 ...\Application.cs:108 trace: [RunInternalAsync] Platform: Windows (x86-64)
15:44:19.057083 ...\Application.cs:109 trace: [RunInternalAsync] OSVersion: 10.0 (build 19045)
15:44:19.057083 ...\Application.cs:110 trace: [RunInternalAsync] AppPath: C:\Program Files\Git\mingw64\bin\git-credential-manager.exe
15:44:19.057083 ...\Application.cs:111 trace: [RunInternalAsync] InstallDir: C:\Program Files\Git\mingw64\bin
15:44:19.057083 ...\Application.cs:112 trace: [RunInternalAsync] Arguments: get
15:44:19.085047 ...GitCommandBase.cs:32 trace: [ExecuteAsync] Start 'get' command...
15:44:19.095047 ...GitCommandBase.cs:46 trace: [ExecuteAsync] Detecting host provider for input:
15:44:19.097048 ...GitCommandBase.cs:47 trace: [ExecuteAsync] capability[]=authtype
15:44:19.097048 ...GitCommandBase.cs:47 trace: [ExecuteAsync] capability[]=state
15:44:19.097048 ...GitCommandBase.cs:47 trace: [ExecuteAsync] protocol=https
15:44:19.097048 ...GitCommandBase.cs:47 trace: [ExecuteAsync] host=github.com
15:44:19.097048 ...GitCommandBase.cs:47 trace: [ExecuteAsync] wwwauth=Basic realm="GitHub"
15:44:19.100081 ...viderRegistry.cs:149 trace: [GetProviderAsync] Performing auto-detection of host provider.
15:44:19.100081 ...viderRegistry.cs:162 trace: [GetProviderAsync] Auto-detect probe timeout is 2 ms.
15:44:19.101049 ...viderRegistry.cs:170 trace: [GetProviderAsync] Checking against 4 host providers registered with priority 'Normal'.
15:44:19.103049 ...GitCommandBase.cs:49 trace: [ExecuteAsync] Host provider 'GitHub' was selected.
15:44:19.109048 ...bHostProvider.cs:142 trace: [GetCredentialAsync] Found 1 accounts in the store for service=https://github.com:
15:44:19.109048 ...bHostProvider.cs:145 trace: [GetCredentialAsync] John-Saunders_XXXXXX
15:44:19.110048 ...bHostProvider.cs:218 trace: [FilterAccounts] Account filtering is enabled.
15:44:19.113048 ...bHostProvider.cs:226 trace: [FilterAccounts] Filtering based on WWW-Authenticate header information...
15:44:19.113048 ...bHostProvider.cs:229 trace: [FilterAccounts] Matched 0 accounts with public domain:
15:44:19.113048 ...bHostProvider.cs:181 trace: [GetCredentialAsync] No existing credentials found.
15:44:19.114048 ...bHostProvider.cs:184 trace: [GetCredentialAsync] Creating new credential...
15:44:19.116048 ...bHostProvider.cs:420 trace: [GetSupportedAuthenticationModesAsync] https://github.com/ is github.com - authentication schemes: 'Pat, OAuth'

@wjohnsaunders
Copy link

I just wanted to add that maybe the GitHub filtering is meant to work with the useHttpPath option, which stores a credential per repo, rather than a single credential for all of GitHub. If so then maybe you could configure the filtering to use that option, rather that creating another for the same purpose.

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
Projects
None yet
Development

No branches or pull requests

5 participants
@mjcheetham @wjohnsaunders @jaatwork and others