git-ecosystem / git-credential-manager

Secure, cross-platform Git credential storage with authentication to GitHub, Azure Repos, and other popular Git hosting services.
Other
6.69k stars 1.74k forks source link

Github UI spam on macOS, never actually stores and reuses the credentials in the keychain #1157

Closed Lancelotbronner closed 1 year ago

Lancelotbronner commented 1 year ago

Version

2.0.931+f99d745b98

Operating system

macOS

OS version or distribution

13.2.1 (22D68)

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

I should have to authenticate once and the credentials will be stored in keychain. The credentials should then be fetched from keychain whenever required without prompting me with anything.

On a sidenote, your issue template still refers to credential-manager-core for commands which then complain that it was renamed to credential-manager.

Actual behavior

The GitHub authentication UI interrupts me every 1 to 5 minutes when working. Sometimes popping two or three windows at once.

Logs

gcm-diagnose.log

karlitos-ozo commented 1 year ago

I have similar issue with version 2.0.886+ea93cb5158 on Ubuntu 22.04

doesn't matter what I choose for credentialStore

ldennington commented 1 year ago

Are you using Git via the terminal or via a 3rd party application (e.g. VS Code, Sourcetree, etc.)?

Also, can you please provide TRACE logs? The diagnose information unfortunately doesn't give us too much to go off of. Use these instructions to enable tracing, then run:

git-credential-manager get

then (making sure to include the extra CRLF (in other words, a blank line) at the end to terminate your list of attributes):

protocol=https
host=github.com

Attach traces in a comment, redacting if necessary.

Lancelotbronner commented 1 year ago

I'm using third-party applications (Github Desktop, Tower, Xcode, Visual Studio for Mac) but during the trace I made sure to try both. The trace freezes on the following:

23:20:22.871809 ...re/Application.cs:95 trace: [RunInternalAsync] Version: 2.0.931.40441
23:20:22.876098 ...re/Application.cs:96 trace: [RunInternalAsync] Runtime: .NET 6.0.14
23:20:22.876109 ...re/Application.cs:97 trace: [RunInternalAsync] Platform: macOS (ARM64)
23:20:22.876114 ...re/Application.cs:98 trace: [RunInternalAsync] OSVersion: 13.2.1
23:20:22.876119 ...re/Application.cs:99 trace: [RunInternalAsync] AppPath: /usr/local/bin/git-credential-manager
23:20:22.876150 ...e/Application.cs:100 trace: [RunInternalAsync] InstallDir: /usr/local/share/gcm-core/
23:20:22.876160 ...e/Application.cs:101 trace: [RunInternalAsync] Arguments: get
23:20:22.905178 ...GitCommandBase.cs:33 trace: [ExecuteAsync] Start 'get' command...

And has been for a few hours (I killed it and tried again a few times, always the same result) now while I was working and getting bugged by that UI repeatedly.

ldennington commented 1 year ago

The application is waiting for the additional input called out above:

protocol=https
host=github.com

Please also include the extra CRLF (i.e. blank line) at the end to terminate your list of attributes.

karlitos-ozo commented 1 year ago

I tried as you suggested and here is my results. after seeing that the get does indeed return same thing that I can see with Ubuntu(I know it says pop_os, but it's really the same ubuntu 22.04, besides some minor, mostly theming changes) passwords, I tried to fetch changes to a private GitHub repo and it asked for me to sign-in. so I did login(using code this time, but the outcome was same as just using browser). right after that I retried fetching and was again asked to sign-in

here is picture and terminal output:

image

$ git-credential-manager get
\17:07:09.484554 ...re/Application.cs:95 trace: [RunInternalAsync] Version: 2.0.935.18315
17:07:09.489900 ...re/Application.cs:96 trace: [RunInternalAsync] Runtime: .NET 6.0.14
17:07:09.489910 ...re/Application.cs:97 trace: [RunInternalAsync] Platform: Linux (x86-64)
17:07:09.489914 ...re/Application.cs:98 trace: [RunInternalAsync] OSVersion: Linux pop-os 6.2.0-76060200-generic #202302191831~1677858327~22.04~3cea1be SMP PREEMPT_DYNAMIC Fri M x86_64 x86_64 x86_64 GNU/Linux
17:07:09.489917 ...re/Application.cs:99 trace: [RunInternalAsync] AppPath: /usr/local/bin/git-credential-manager
17:07:09.489952 ...e/Application.cs:100 trace: [RunInternalAsync] InstallDir: /usr/local/share/gcm-core/
17:07:09.489961 ...e/Application.cs:101 trace: [RunInternalAsync] Arguments: get
17:07:09.530223 ...GitCommandBase.cs:33 trace: [ExecuteAsync] Start 'get' command...
protocol=https
host=github.com

17:07:34.718466 ...GitCommandBase.cs:47 trace: [ExecuteAsync] Detecting host provider for input:
17:07:34.720706 ...GitCommandBase.cs:48 trace: [ExecuteAsync]   protocol=https
17:07:34.720731 ...GitCommandBase.cs:48 trace: [ExecuteAsync]   host=github.com
17:07:34.728437 ...viderRegistry.cs:149 trace: [GetProviderAsync] Performing auto-detection of host provider.
17:07:34.730268 ...viderRegistry.cs:162 trace: [GetProviderAsync] Auto-detect probe timeout is 2 ms.
17:07:34.731782 ...viderRegistry.cs:170 trace: [GetProviderAsync] Checking against 4 host providers registered with priority 'Normal'.
17:07:34.732572 ...GitCommandBase.cs:50 trace: [ExecuteAsync] Host provider 'GitHub' was selected.
17:07:34.734117 .../HostProvider.cs:126 trace: [GetCredentialAsync] Looking for existing credential in store with service=https://github.com account=...
17:07:34.766137 .../HostProvider.cs:140 trace: [GetCredentialAsync] Existing credential found.
17:07:34.766240 ...nds/GetCommand.cs:39 trace: [ExecuteInternalAsync] Writing credentials to output:
17:07:34.766260 ...nds/GetCommand.cs:40 trace: [ExecuteInternalAsync]   protocol=https
17:07:34.766265 ...nds/GetCommand.cs:40 trace: [ExecuteInternalAsync]   host=github.com
17:07:34.766274 ...nds/GetCommand.cs:40 trace: [ExecuteInternalAsync]   username=karlitos-ozo
17:07:34.766278 ...nds/GetCommand.cs:40 trace: [ExecuteInternalAsync]   password=********
protocol=https
host=github.com
username=karlitos-ozo
password=gho_ADN_SOME_RANDOM_STRING_HERE

17:07:34.766652 ...GitCommandBase.cs:54 trace: [ExecuteAsync] End 'get' command...
$ git fetch
17:08:56.366621 ...re/Application.cs:95 trace: [RunInternalAsync] Version: 2.0.935.18315
17:08:56.367772 ...re/Application.cs:96 trace: [RunInternalAsync] Runtime: .NET 6.0.14
17:08:56.367782 ...re/Application.cs:97 trace: [RunInternalAsync] Platform: Linux (x86-64)
17:08:56.367785 ...re/Application.cs:98 trace: [RunInternalAsync] OSVersion: Linux pop-os 6.2.0-76060200-generic #202302191831~1677858327~22.04~3cea1be SMP PREEMPT_DYNAMIC Fri M x86_64 x86_64 x86_64 GNU/Linux
17:08:56.367788 ...re/Application.cs:99 trace: [RunInternalAsync] AppPath: /usr/local/bin/git-credential-manager
17:08:56.367823 ...e/Application.cs:100 trace: [RunInternalAsync] InstallDir: /usr/local/share/gcm-core/
17:08:56.367833 ...e/Application.cs:101 trace: [RunInternalAsync] Arguments: get
17:08:56.409340 ...GitCommandBase.cs:33 trace: [ExecuteAsync] Start 'get' command...
17:08:56.416769 ...GitCommandBase.cs:47 trace: [ExecuteAsync] Detecting host provider for input:
17:08:56.418966 ...GitCommandBase.cs:48 trace: [ExecuteAsync]   protocol=https
17:08:56.418977 ...GitCommandBase.cs:48 trace: [ExecuteAsync]   host=github.com
17:08:56.418984 ...GitCommandBase.cs:48 trace: [ExecuteAsync]   username=karlistos-ozo
17:08:56.426806 ...viderRegistry.cs:149 trace: [GetProviderAsync] Performing auto-detection of host provider.
17:08:56.428609 ...viderRegistry.cs:162 trace: [GetProviderAsync] Auto-detect probe timeout is 2 ms.
17:08:56.430084 ...viderRegistry.cs:170 trace: [GetProviderAsync] Checking against 4 host providers registered with priority 'Normal'.
17:08:56.430778 ...GitCommandBase.cs:50 trace: [ExecuteAsync] Host provider 'GitHub' was selected.
17:08:56.432130 .../HostProvider.cs:126 trace: [GetCredentialAsync] Looking for existing credential in store with service=https://github.com account=karlistos-ozo...
17:08:56.464748 .../HostProvider.cs:131 trace: [GetCredentialAsync] No existing credentials found.
17:08:56.464790 .../HostProvider.cs:134 trace: [GetCredentialAsync] Creating new credential...
17:08:56.470369 ...bHostProvider.cs:255 trace: [GetSupportedAuthenticationModesAsync] https://github.com/ is github.com - authentication schemes: 'Pat, OAuth'
17:08:56.480471 ...nticationBase.cs:150 trace: [TryFindHelperCommand] Using default UI helper: 'GitHub.UI'.
17:08:56.480510 ...nticationBase.cs:181 trace: [TryFindHelperCommand] Found in-box native UI helper: '/usr/local/share/gcm-core/GitHub.UI'
17:08:56.481758 ...enticationBase.cs:40 trace: [InvokeHelperAsync] Starting helper process: /usr/local/share/gcm-core/GitHub.UI prompt --browser --device --pat --username karlistos-ozo
17:09:02.877614 ...pClientFactory.cs:58 trace: [CreateClient] Creating new HTTP client instance...
17:09:03.674075 ...nticationBase.cs:150 trace: [TryFindHelperCommand] Using default UI helper: 'GitHub.UI'.
17:09:03.674099 ...nticationBase.cs:181 trace: [TryFindHelperCommand] Found in-box native UI helper: '/usr/local/share/gcm-core/GitHub.UI'
17:09:03.674199 ...enticationBase.cs:40 trace: [InvokeHelperAsync] Starting helper process: /usr/local/share/gcm-core/GitHub.UI device --code E1AC-14D2  --url https://github.com/login/device
17:10:11.841935 .../GitHubRestApi.cs:95 trace: [GetUserInfoAsync] HTTP: GET https://api.github.com/user
17:10:11.842182 ...pClientFactory.cs:58 trace: [CreateClient] Creating new HTTP client instance...
17:10:12.252332 ...GitHubRestApi.cs:102 trace: [GetUserInfoAsync] HTTP: Response 200 [OK]
17:10:12.255955 .../HostProvider.cs:136 trace: [GetCredentialAsync] Credential created.
17:10:12.256313 ...nds/GetCommand.cs:39 trace: [ExecuteInternalAsync] Writing credentials to output:
17:10:12.256375 ...nds/GetCommand.cs:40 trace: [ExecuteInternalAsync]   protocol=https
17:10:12.256383 ...nds/GetCommand.cs:40 trace: [ExecuteInternalAsync]   host=github.com
17:10:12.256389 ...nds/GetCommand.cs:40 trace: [ExecuteInternalAsync]   username=karlitos-ozo
17:10:12.256392 ...nds/GetCommand.cs:40 trace: [ExecuteInternalAsync]   password=********
17:10:12.256847 ...GitCommandBase.cs:54 trace: [ExecuteAsync] End 'get' command...
17:10:12.724074 ...re/Application.cs:95 trace: [RunInternalAsync] Version: 2.0.935.18315
17:10:12.725369 ...re/Application.cs:96 trace: [RunInternalAsync] Runtime: .NET 6.0.14
17:10:12.725379 ...re/Application.cs:97 trace: [RunInternalAsync] Platform: Linux (x86-64)
17:10:12.725382 ...re/Application.cs:98 trace: [RunInternalAsync] OSVersion: Linux pop-os 6.2.0-76060200-generic #202302191831~1677858327~22.04~3cea1be SMP PREEMPT_DYNAMIC Fri M x86_64 x86_64 x86_64 GNU/Linux
17:10:12.725386 ...re/Application.cs:99 trace: [RunInternalAsync] AppPath: /usr/local/bin/git-credential-manager
17:10:12.725420 ...e/Application.cs:100 trace: [RunInternalAsync] InstallDir: /usr/local/share/gcm-core/
17:10:12.725430 ...e/Application.cs:101 trace: [RunInternalAsync] Arguments: store
17:10:12.768008 ...GitCommandBase.cs:33 trace: [ExecuteAsync] Start 'store' command...
17:10:12.775956 ...GitCommandBase.cs:47 trace: [ExecuteAsync] Detecting host provider for input:
17:10:12.778200 ...GitCommandBase.cs:48 trace: [ExecuteAsync]   protocol=https
17:10:12.778211 ...GitCommandBase.cs:48 trace: [ExecuteAsync]   host=github.com
17:10:12.778214 ...GitCommandBase.cs:48 trace: [ExecuteAsync]   username=karlitos-ozo
17:10:12.778221 ...GitCommandBase.cs:48 trace: [ExecuteAsync]   password=********
17:10:12.785992 ...viderRegistry.cs:149 trace: [GetProviderAsync] Performing auto-detection of host provider.
17:10:12.787894 ...viderRegistry.cs:162 trace: [GetProviderAsync] Auto-detect probe timeout is 2 ms.
17:10:12.789487 ...viderRegistry.cs:170 trace: [GetProviderAsync] Checking against 4 host providers registered with priority 'Normal'.
17:10:12.790270 ...GitCommandBase.cs:50 trace: [ExecuteAsync] Host provider 'GitHub' was selected.
17:10:12.790825 .../HostProvider.cs:160 trace: [StoreCredentialAsync] Storing credential with service=https://github.com account=karlitos-ozo...
17:10:12.849486 .../HostProvider.cs:162 trace: [StoreCredentialAsync] Credential was successfully stored.
17:10:12.849568 ...GitCommandBase.cs:54 trace: [ExecuteAsync] End 'store' command...

and right after in the same folder:

$ git fetch
17:10:27.020941 ...re/Application.cs:95 trace: [RunInternalAsync] Version: 2.0.935.18315
17:10:27.022254 ...re/Application.cs:96 trace: [RunInternalAsync] Runtime: .NET 6.0.14
17:10:27.022264 ...re/Application.cs:97 trace: [RunInternalAsync] Platform: Linux (x86-64)
17:10:27.022268 ...re/Application.cs:98 trace: [RunInternalAsync] OSVersion: Linux pop-os 6.2.0-76060200-generic #202302191831~1677858327~22.04~3cea1be SMP PREEMPT_DYNAMIC Fri M x86_64 x86_64 x86_64 GNU/Linux
17:10:27.022271 ...re/Application.cs:99 trace: [RunInternalAsync] AppPath: /usr/local/bin/git-credential-manager
17:10:27.022307 ...e/Application.cs:100 trace: [RunInternalAsync] InstallDir: /usr/local/share/gcm-core/
17:10:27.022317 ...e/Application.cs:101 trace: [RunInternalAsync] Arguments: get
17:10:27.064826 ...GitCommandBase.cs:33 trace: [ExecuteAsync] Start 'get' command...
17:10:27.072165 ...GitCommandBase.cs:47 trace: [ExecuteAsync] Detecting host provider for input:
17:10:27.074254 ...GitCommandBase.cs:48 trace: [ExecuteAsync]   protocol=https
17:10:27.074266 ...GitCommandBase.cs:48 trace: [ExecuteAsync]   host=github.com
17:10:27.074277 ...GitCommandBase.cs:48 trace: [ExecuteAsync]   username=karlistos-ozo
17:10:27.082456 ...viderRegistry.cs:149 trace: [GetProviderAsync] Performing auto-detection of host provider.
17:10:27.084703 ...viderRegistry.cs:162 trace: [GetProviderAsync] Auto-detect probe timeout is 2 ms.
17:10:27.086840 ...viderRegistry.cs:170 trace: [GetProviderAsync] Checking against 4 host providers registered with priority 'Normal'.
17:10:27.087720 ...GitCommandBase.cs:50 trace: [ExecuteAsync] Host provider 'GitHub' was selected.
17:10:27.089177 .../HostProvider.cs:126 trace: [GetCredentialAsync] Looking for existing credential in store with service=https://github.com account=karlistos-ozo...
17:10:27.117938 .../HostProvider.cs:131 trace: [GetCredentialAsync] No existing credentials found.
17:10:27.117965 .../HostProvider.cs:134 trace: [GetCredentialAsync] Creating new credential...
17:10:27.125406 ...bHostProvider.cs:255 trace: [GetSupportedAuthenticationModesAsync] https://github.com/ is github.com - authentication schemes: 'Pat, OAuth'
17:10:27.136229 ...nticationBase.cs:150 trace: [TryFindHelperCommand] Using default UI helper: 'GitHub.UI'.
17:10:27.136265 ...nticationBase.cs:181 trace: [TryFindHelperCommand] Found in-box native UI helper: '/usr/local/share/gcm-core/GitHub.UI'
17:10:27.137599 ...enticationBase.cs:40 trace: [InvokeHelperAsync] Starting helper process: /usr/local/share/gcm-core/GitHub.UI prompt --browser --device --pat --username karlistos-ozo
karlitos-ozo commented 1 year ago

I fixed the issue that I had. Not sure how, though. I just remembered that I have 2 GitHub accounts I use on this PC. One is work and the other is my personal so all the notifications don't mix + GitHub was bad with tokens not long ago.

So I tried to checkout private repo owned by other account and it by default tried to use this GitHub account and it failed. logs:

$ git clone https://github.com/otheruser/private_repo.git
Cloning into 'wiki'...
17:54:41.279160 ...re/Application.cs:95 trace: [RunInternalAsync] Version: 2.0.935.18315
17:54:41.280320 ...re/Application.cs:96 trace: [RunInternalAsync] Runtime: .NET 6.0.14
17:54:41.280331 ...re/Application.cs:97 trace: [RunInternalAsync] Platform: Linux (x86-64)
17:54:41.280337 ...re/Application.cs:98 trace: [RunInternalAsync] OSVersion: Linux pop-os 6.2.0-76060200-generic #202302191831~1677858327~22.04~3cea1be SMP PREEMPT_DYNAMIC Fri M x86_64 x86_64 x86_64 GNU/Linux
17:54:41.280341 ...re/Application.cs:99 trace: [RunInternalAsync] AppPath: /usr/local/bin/git-credential-manager
17:54:41.280398 ...e/Application.cs:100 trace: [RunInternalAsync] InstallDir: /usr/local/share/gcm-core/
17:54:41.280407 ...e/Application.cs:101 trace: [RunInternalAsync] Arguments: get
17:54:41.323254 ...GitCommandBase.cs:33 trace: [ExecuteAsync] Start 'get' command...
17:54:41.330969 ...GitCommandBase.cs:47 trace: [ExecuteAsync] Detecting host provider for input:
17:54:41.333189 ...GitCommandBase.cs:48 trace: [ExecuteAsync]   protocol=https
17:54:41.333199 ...GitCommandBase.cs:48 trace: [ExecuteAsync]   host=github.com
17:54:41.340888 ...viderRegistry.cs:149 trace: [GetProviderAsync] Performing auto-detection of host provider.
17:54:41.342731 ...viderRegistry.cs:162 trace: [GetProviderAsync] Auto-detect probe timeout is 2 ms.
17:54:41.344142 ...viderRegistry.cs:170 trace: [GetProviderAsync] Checking against 4 host providers registered with priority 'Normal'.
17:54:41.344864 ...GitCommandBase.cs:50 trace: [ExecuteAsync] Host provider 'GitHub' was selected.
17:54:41.346341 .../HostProvider.cs:126 trace: [GetCredentialAsync] Looking for existing credential in store with service=https://github.com account=...
17:54:41.377567 .../HostProvider.cs:140 trace: [GetCredentialAsync] Existing credential found.
17:54:41.377710 ...nds/GetCommand.cs:39 trace: [ExecuteInternalAsync] Writing credentials to output:
17:54:41.377729 ...nds/GetCommand.cs:40 trace: [ExecuteInternalAsync]   protocol=https
17:54:41.377755 ...nds/GetCommand.cs:40 trace: [ExecuteInternalAsync]   host=github.com
17:54:41.377758 ...nds/GetCommand.cs:40 trace: [ExecuteInternalAsync]   username=karlitos-ozo
17:54:41.377761 ...nds/GetCommand.cs:40 trace: [ExecuteInternalAsync]   password=********
17:54:41.378184 ...GitCommandBase.cs:54 trace: [ExecuteAsync] End 'get' command...
remote: Repository not found.
fatal: repository 'https://github.com/obfuscating/this.git/' not found

Then providing the user account that I have already Signed-in on this PC it succeeds. (I find it interesting that it also seems to store the credentials, but not that it matters as this worked.

$ git clone https://other-user@github.com/other-user/private.git
Cloning into 'private'...
17:54:53.487317 ...re/Application.cs:95 trace: [RunInternalAsync] Version: 2.0.935.18315
17:54:53.488541 ...re/Application.cs:96 trace: [RunInternalAsync] Runtime: .NET 6.0.14
17:54:53.488550 ...re/Application.cs:97 trace: [RunInternalAsync] Platform: Linux (x86-64)
17:54:53.488554 ...re/Application.cs:98 trace: [RunInternalAsync] OSVersion: Linux pop-os 6.2.0-76060200-generic #202302191831~1677858327~22.04~3cea1be SMP PREEMPT_DYNAMIC Fri M x86_64 x86_64 x86_64 GNU/Linux
17:54:53.488557 ...re/Application.cs:99 trace: [RunInternalAsync] AppPath: /usr/local/bin/git-credential-manager
17:54:53.488592 ...e/Application.cs:100 trace: [RunInternalAsync] InstallDir: /usr/local/share/gcm-core/
17:54:53.488601 ...e/Application.cs:101 trace: [RunInternalAsync] Arguments: get
17:54:53.530033 ...GitCommandBase.cs:33 trace: [ExecuteAsync] Start 'get' command...
17:54:53.537550 ...GitCommandBase.cs:47 trace: [ExecuteAsync] Detecting host provider for input:
17:54:53.539659 ...GitCommandBase.cs:48 trace: [ExecuteAsync]   protocol=https
17:54:53.539670 ...GitCommandBase.cs:48 trace: [ExecuteAsync]   host=github.com
17:54:53.539678 ...GitCommandBase.cs:48 trace: [ExecuteAsync]   username=other-user
17:54:53.547139 ...viderRegistry.cs:149 trace: [GetProviderAsync] Performing auto-detection of host provider.
17:54:53.548892 ...viderRegistry.cs:162 trace: [GetProviderAsync] Auto-detect probe timeout is 2 ms.
17:54:53.550434 ...viderRegistry.cs:170 trace: [GetProviderAsync] Checking against 4 host providers registered with priority 'Normal'.
17:54:53.551142 ...GitCommandBase.cs:50 trace: [ExecuteAsync] Host provider 'GitHub' was selected.
17:54:53.552496 .../HostProvider.cs:126 trace: [GetCredentialAsync] Looking for existing credential in store with service=https://github.com account=other-user...
17:54:53.583542 .../HostProvider.cs:140 trace: [GetCredentialAsync] Existing credential found.
17:54:53.583726 ...nds/GetCommand.cs:39 trace: [ExecuteInternalAsync] Writing credentials to output:
17:54:53.583793 ...nds/GetCommand.cs:40 trace: [ExecuteInternalAsync]   protocol=https
17:54:53.583797 ...nds/GetCommand.cs:40 trace: [ExecuteInternalAsync]   host=github.com
17:54:53.583801 ...nds/GetCommand.cs:40 trace: [ExecuteInternalAsync]   username=other-user
17:54:53.583805 ...nds/GetCommand.cs:40 trace: [ExecuteInternalAsync]   password=********
17:54:53.584237 ...GitCommandBase.cs:54 trace: [ExecuteAsync] End 'get' command...
17:54:54.114122 ...re/Application.cs:95 trace: [RunInternalAsync] Version: 2.0.935.18315
17:54:54.115258 ...re/Application.cs:96 trace: [RunInternalAsync] Runtime: .NET 6.0.14
17:54:54.115267 ...re/Application.cs:97 trace: [RunInternalAsync] Platform: Linux (x86-64)
17:54:54.115271 ...re/Application.cs:98 trace: [RunInternalAsync] OSVersion: Linux pop-os 6.2.0-76060200-generic #202302191831~1677858327~22.04~3cea1be SMP PREEMPT_DYNAMIC Fri M x86_64 x86_64 x86_64 GNU/Linux
17:54:54.115274 ...re/Application.cs:99 trace: [RunInternalAsync] AppPath: /usr/local/bin/git-credential-manager
17:54:54.115307 ...e/Application.cs:100 trace: [RunInternalAsync] InstallDir: /usr/local/share/gcm-core/
17:54:54.115317 ...e/Application.cs:101 trace: [RunInternalAsync] Arguments: store
17:54:54.155033 ...GitCommandBase.cs:33 trace: [ExecuteAsync] Start 'store' command...
17:54:54.163325 ...GitCommandBase.cs:47 trace: [ExecuteAsync] Detecting host provider for input:
17:54:54.165516 ...GitCommandBase.cs:48 trace: [ExecuteAsync]   protocol=https
17:54:54.165533 ...GitCommandBase.cs:48 trace: [ExecuteAsync]   host=github.com
17:54:54.165537 ...GitCommandBase.cs:48 trace: [ExecuteAsync]   username=karother-user
17:54:54.165539 ...GitCommandBase.cs:48 trace: [ExecuteAsync]   password=********
17:54:54.173240 ...viderRegistry.cs:149 trace: [GetProviderAsync] Performing auto-detection of host provider.
17:54:54.174881 ...viderRegistry.cs:162 trace: [GetProviderAsync] Auto-detect probe timeout is 2 ms.
17:54:54.176331 ...viderRegistry.cs:170 trace: [GetProviderAsync] Checking against 4 host providers registered with priority 'Normal'.
17:54:54.177477 ...GitCommandBase.cs:50 trace: [ExecuteAsync] Host provider 'GitHub' was selected.
17:54:54.178159 .../HostProvider.cs:160 trace: [StoreCredentialAsync] Storing credential with service=https://github.com account=other-user...
17:54:54.209678 .../HostProvider.cs:162 trace: [StoreCredentialAsync] Credential was successfully stored.
17:54:54.209707 ...GitCommandBase.cs:54 trace: [ExecuteAsync] End 'store' command...

Probably the important part:

After seeing that this works, I decided to checkout repo with this account and that works no matter, if I set or don't set the user using the https://`user@`github.com/some/repo.git

so I went in to repo that I had problems with and checked the remote url of origin and it was https://karlistos-ozo@github.com/some/repo.git

after removing user form the url, the git fetch worked perfectly.

Tl;Dr: changing remote url from https://`user@`github.com/some/repo.git to https://github.com/some/repo.git worked for me. (I also had removed this users credentials from password store some days ago, but that didn't help so not sure what the actual the cause for me as I hadn't updated GCM for some months and this error popped up in middle of last week.) Was it actually old version, old credentials or something else, I don't know

ldennington commented 1 year ago

Yes, I was just typing out a response saying it looked like there was a conflated username here. This is based on what Git was storing for the first fetch:

protocol=https
host=github.com
username=karlitos-ozo
password=********

Versus what it was trying to get:

protocol=https
host=github.com
username=karlistos-ozo

So, essentially a credential was stored for karlitos-ozo and then Git tried to retrieve one for karlistos-ozo and GCM couldn't find a match. Glad you were able to resolve by removing the username from the URL.

Lancelotbronner commented 1 year ago

Hey, this was my issue and it isn't resolved. Please re-open it.

Trace.txt

ldennington commented 1 year ago

Oh! Sorry, that's my bad - I didn't realize @karlitos-ozo hadn't created this.

ldennington commented 1 year ago

@Lancelotbronner - your get trace looks fine, as does your diagnose. To get a more complete picture, please enable tracing in your terminal (by setting GIT_TRACE=1 and GCM_TRACE=1), run a few of the commands you're having trouble with, and share the redacted output.

bthomale commented 1 year ago

I ran into this exact issue on one of my computers today. TL;DR try uninstalling and reinstalling git-credential-manager, it worked for me.

When I looked at the Console, I saw the error "MacOS Error -25294" over and over (sorry, I lost the exact wording and the log is cleared now) for the process "git-credential-manager". It's this error: errSecNoSuchKeychain: https://developer.apple.com/forums/thread/675290

Also, I could see this keychain entry on my working computer: "git:https://github.com". That seemed to be what git-credentials-manager was updating, but that entry was missing on the computer that was endlessly prompting me. So, clearly, it wasn't writing something it should have been able to.

At first, I was worried my keychain was messed up, but other applications seemed able to access it fine. So I decided to try the old standby of uninstalling and reinstalling git-credentials-manager. I had used homebrew, so:

brew uninstall --cask git-credential-manager-core

brew install --cask git-credential-manager-core

And that worked! After this, I did one last sign-in with git-credentials-manager, the expected keychain entry appeared, and I haven't been prompted since. (I also had tried updating using brew, but that didn't work because it was up-to-date.)

I suspect a recent OS update might have broken things? It was working before.

ldennington commented 1 year ago

@Lancelotbronner - can you try uninstalling and re-installing to see if that works for you?

Lancelotbronner commented 1 year ago

I had tried getting verbose and debug logs but it never outputs anything so I uninstalled it and found out it wasn't actually necessary as git could somehow retrieve all the credentials itself

ldennington commented 1 year ago

Great - I will go ahead and close this issue then.

kylemay-gridstone commented 1 year ago

I have tried the uninstall and reinstall steps but it didn't solve it for me.

sayzenberg commented 1 year ago

@ldennington I'm seeing the same issue. Uninstalling and reinstalling fixes the problem for maybe a week or so, and then it comes back. Can we reactivate this, or should I just open a new issue?

bthomale commented 1 year ago

Maybe it should be reopened.

Did it start happening after you installed Xcode 14.3? That is when it seemed to happen for me. The problem initially happened the day I upgraded to Xcode 14.3.

It did actually come back once on me too. It seemed to happen when Xcode was running, and sometimes when I had keychain open I could actually see the entry appear and then disappear.

I wonder if Xcode's git integration might be doing something in the background that is nuking the keychain entry?

On my computer where I never had the problem, I have the background Git integration options in Xcode all turned off. (Because they have always caused random Xcode crashes in the background for me.) I happened to have had them on, on the mini. After the problem came back again, and I started suspecting Xcode was the culprit, I compared my Xcode git settings between the two machines. I tried turning the Xcode git settings off and the problem hasn't come back.

The settings I use are: I leave "Enable Source Control" on (so you can still use the features that the user triggers like "blame," history, and the code comparison), but I turn off the checkboxes below it that do things automatically in the background like "Refresh local status automatically", etc.

I could try turning those on, on the laptop that never had the issue, just to see if that makes it happen here too. That would make Xcode a really strong suspect. I am almost afraid to though! It's a crippling bug when it happens.

kylemay-gridstone commented 1 year ago

Did it start happening after you installed Xcode 14.3?

Yes this started happening for me the day I installed macOS Ventura and Xcode 14.3. Will try your changes to the Xcode git settings.

bthomale commented 1 year ago

Yeah that's real suspicious. I was running Ventura for months (and Xcode 14.2 and earlier) without issues but Xcode 14.3 could definitely be the culprit, I installed it the day it happened, too.

FWIW I turned those options on, on my laptop, and I still couldn't get it to happen. So I'm still not sure what causes it. It hasn't come back again on the other computer again yet either.

The only other difference I can think of between these two computers is Intel vs Arm. The computer that had the issues is an M1 mini. The laptop that has never had it is an intel 16" Macbook Pro. (That last model before the M1.)

mjcheetham commented 1 year ago

Hello all!

We've identified an issue with the keychain interaction of GCM when started inside of Xcode 14.3 and are actively investigating.

In the mean time, disabling the 'auto fetch' feature in Xcode will stop these unexpected 'nuking' of the keychain entry, and avoiding using fetch or push from Xcode.

image

mjcheetham commented 1 year ago

Related issue in the MSAL repo: https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/issues/4117

A comprehensive fix to this may also require updates to the MSAL.NET extensions library.

KernelBypass commented 1 year ago

Hello all!

We've identified an issue with the keychain interaction of GCM when started inside of Xcode 14.3 and are actively investigating.

In the mean time, disabling the 'auto fetch' feature in Xcode will stop these unexpected 'nuking' of the keychain entry, and avoiding using fetch or push from Xcode.

image

This happens to me on 14.3 even with that option unchecked. Is there an ETA on the fix? Thanks

ldennington commented 1 year ago

This happens to me on 14.3 even with that option unchecked. Is there an ETA on the fix? Thanks

Apple has released XCode 15 beta 4 with the fix. Note that there is a caveat - you will first need to run git fetch from your repo in a terminal outside of XCode. Once you've done that, though, the issue should be permanently corrected.

The maintainers have not yet had a chance to test the fix, but you might try the above to see if it resolves your issue (and if you could follow up here to let us know, we'd appreciate it!).

Edit: @mjcheetham was able to test the new beta today, and it worked without the caveat of doing first auth from a terminal outside of XCode.

ldennington commented 1 year ago

Closing based on the confirmation that XCode 15 beta 4 fixes the issue.

ts95 commented 1 year ago

I'm currently running Xcode 15 beta 7 and this issue is still affecting me. It has been for the past two months. When I leave my Mac unattended for a while I return to 20 Github.UI popups that I need to close, and after a while the system gets so clogged with git processes that it starts getting laggy. I have no idea what to do about this and it's driving me nuts. Alas, unchecking the "Fetch and refresh server status automatically" option in Xcode didn't resolve the issue for me. I've also tried running git fetch, but that didn't help either.

mjcheetham commented 1 year ago

Alas, unchecking the "Fetch and refresh server status automatically" option in Xcode didn't resolve the issue for me. I've also tried running git fetch, but that didn't help either.

@ts95 this doesn't sound like an Xcode issue if you've disabled the auto fetch option. Please open a new issue documenting the problem.