git-ecosystem/git-credential-manager

Hang when using linux pass.

Opened this issue · 2 comments

Version

2.5.1+90d5f897f164a8fe07d2aa3bf7db439b0b4e03ea

Operating system

Linux

OS version or distribution

Ubuntu 2024

Git hosting provider(s)

Azure DevOps

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

things work or error

Actual behavior

Fetch and psuh both hang and git-credential-manager get hangs as well. I at leat expect an error rather than a hang.

GCM_TRACE=1 GIT_TRACE=1 git fetch
23:01:47.575391 git.c:455 trace: built-in: git fetch
23:01:47.575584 run-command.c:668 trace: run_command: GIT_DIR=.git git remote-https origin https://msazure.visualstudio.com/DefaultCollection/CloudNativeCompute/_git/aks-rp
23:01:47.576387 git.c:742 trace: exec: git-remote-https origin https://msazure.visualstudio.com/DefaultCollection/CloudNativeCompute/_git/aks-rp
23:01:47.576415 run-command.c:668 trace: run_command: git-remote-https origin https://msazure.visualstudio.com/DefaultCollection/CloudNativeCompute/_git/aks-rp
23:01:47.737658 run-command.c:668 trace: run_command: '/usr/local/bin/git-credential-manager get'
23:01:47.816553 git.c:455 trace: built-in: git config --null --list
23:01:47.855780 ...e/Application.cs:106 trace: [RunInternalAsync] Version: 2.5.1.0
23:01:47.862254 ...e/Application.cs:107 trace: [RunInternalAsync] Runtime: .NET 8.0.6
23:01:47.862298 ...e/Application.cs:108 trace: [RunInternalAsync] Platform: Linux (x86-64)
23:01:47.862307 ...e/Application.cs:109 trace: [RunInternalAsync] OSVersion: Ubuntu 22.04.4 LTS
23:01:47.862317 ...e/Application.cs:110 trace: [RunInternalAsync] AppPath: /usr/local/bin/git-credential-manager
23:01:47.862390 ...e/Application.cs:111 trace: [RunInternalAsync] InstallDir: /usr/local/share/gcm-core/
23:01:47.862424 ...e/Application.cs:112 trace: [RunInternalAsync] Arguments: get
23:01:47.887028 ...GitCommandBase.cs:32 trace: [ExecuteAsync] Start 'get' command...
23:01:47.902668 ...GitCommandBase.cs:46 trace: [ExecuteAsync] Detecting host provider for input:
23:01:47.903887 ...GitCommandBase.cs:47 trace: [ExecuteAsync] protocol=https
23:01:47.903924 ...GitCommandBase.cs:47 trace: [ExecuteAsync] host=msazure.visualstudio.com
23:01:47.907114 ...viderRegistry.cs:149 trace: [GetProviderAsync] Performing auto-detection of host provider.
23:01:47.909055 ...viderRegistry.cs:162 trace: [GetProviderAsync] Auto-detect probe timeout is 2 ms.
23:01:47.912702 ...viderRegistry.cs:170 trace: [GetProviderAsync] Checking against 4 host providers registered with priority 'Normal'.
23:01:47.913321 ...GitCommandBase.cs:49 trace: [ExecuteAsync] Host provider 'Azure Repos' was selected.
23:01:47.916560 ...osHostProvider.cs:99 trace: [GetCredentialAsync] Looking for existing credential in store with service=https://msazure.visualstudio.com account=...
23:01:47.918348 ...edentialStore.cs:364 trace: [GetGpgPath] Using PATH-located GPG (gpg) executable: /usr/bin/gpg

-> % git-credential-manager get23:00:02.876648 ...e/Application.cs:106 trace: [RunInternalAsync] Version: 2.5.1.0
23:00:02.886785 ...e/Application.cs:107 trace: [RunInternalAsync] Runtime: .NET 8.0.6
23:00:02.886829 ...e/Application.cs:108 trace: [RunInternalAsync] Platform: Linux (x86-64)
23:00:02.886837 ...e/Application.cs:109 trace: [RunInternalAsync] OSVersion: Ubuntu 22.04.4 LTS
23:00:02.886845 ...e/Application.cs:110 trace: [RunInternalAsync] AppPath: /usr/local/bin/git-credential-manager
23:00:02.886899 ...e/Application.cs:111 trace: [RunInternalAsync] InstallDir: /usr/local/share/gcm-core/
23:00:02.886931 ...e/Application.cs:112 trace: [RunInternalAsync] Arguments: get
23:00:02.911431 ...GitCommandBase.cs:32 trace: [ExecuteAsync] Start 'get' command...

Logs

I'm using the utility pass on linyx and while typing my pin in control-c'd pass. This seems to corrupt somthing. If I do pass rm -r git I can at least do one push or pull but after that I'm hung agan

Here's it temporarily working after pass rm -r git but notice theres a stack trace hidden in the middle which indicates its failed to save.

atal: Failed to encrypt file '/home/pmiller/.password-store/git/https/msazure.visualstudio.com/pmiller@microsoft.com.gpg' with gpg. exit=2, out=, err=gpg: whatever: skipped: No public key
gpg: [stdin]: encryption failed: No public key

at GitCredentialManager.Gpg.EncryptFile(String path, String gpgId, String contents)
at GitCredentialManager.Interop.Posix.GpgPassCredentialStore.SerializeCredential(FileCredential credential)
at GitCredentialManager.PlaintextCredentialStore.AddOrUpdate(String service, String account, String

-> % pass rm -r git
Are you sure you would like to delete git? [y/N] y
removed '/home/pmiller/.password-store/git/https/msazure.visualstudio.com/pmiller@microsoft.com.gpg'
removed directory '/home/pmiller/.password-store/git/https/msazure.visualstudio.com'
removed directory '/home/pmiller/.password-store/git/https'
removed directory '/home/pmiller/.password-store/git/'
pmiller@millercloud2 [23:03:57] [~/aks-rp4] [pmiller/calico328 *]
-> % GCM_TRACE=1 GIT_TRACE=1 git fetch
23:04:02.748911 git.c:455 trace: built-in: git fetch
23:04:02.749108 run-command.c:668 trace: run_command: GIT_DIR=.git git remote-https origin https://msazure.visualstudio.com/DefaultCollection/CloudNativeCompute/_git/aks-rp
23:04:02.750121 git.c:742 trace: exec: git-remote-https origin https://msazure.visualstudio.com/DefaultCollection/CloudNativeCompute/_git/aks-rp
23:04:02.750147 run-command.c:668 trace: run_command: git-remote-https origin https://msazure.visualstudio.com/DefaultCollection/CloudNativeCompute/_git/aks-rp
23:04:02.798592 run-command.c:668 trace: run_command: '/usr/local/bin/git-credential-manager get'
23:04:02.920488 git.c:455 trace: built-in: git config --null --list
23:04:02.963596 ...e/Application.cs:106 trace: [RunInternalAsync] Version: 2.5.1.0
23:04:02.970478 ...e/Application.cs:107 trace: [RunInternalAsync] Runtime: .NET 8.0.6
23:04:02.970534 ...e/Application.cs:108 trace: [RunInternalAsync] Platform: Linux (x86-64)
23:04:02.970549 ...e/Application.cs:109 trace: [RunInternalAsync] OSVersion: Ubuntu 22.04.4 LTS
23:04:02.970573 ...e/Application.cs:110 trace: [RunInternalAsync] AppPath: /usr/local/bin/git-credential-manager
23:04:02.970665 ...e/Application.cs:111 trace: [RunInternalAsync] InstallDir: /usr/local/share/gcm-core/
23:04:02.970713 ...e/Application.cs:112 trace: [RunInternalAsync] Arguments: get
23:04:02.996539 ...GitCommandBase.cs:32 trace: [ExecuteAsync] Start 'get' command...
23:04:03.011650 ...GitCommandBase.cs:46 trace: [ExecuteAsync] Detecting host provider for input:
23:04:03.012956 ...GitCommandBase.cs:47 trace: [ExecuteAsync] protocol=https
23:04:03.012994 ...GitCommandBase.cs:47 trace: [ExecuteAsync] host=msazure.visualstudio.com
23:04:03.016158 ...viderRegistry.cs:149 trace: [GetProviderAsync] Performing auto-detection of host provider.
23:04:03.018250 ...viderRegistry.cs:162 trace: [GetProviderAsync] Auto-detect probe timeout is 2 ms.
23:04:03.022039 ...viderRegistry.cs:170 trace: [GetProviderAsync] Checking against 4 host providers registered with priority 'Normal'.
23:04:03.022690 ...GitCommandBase.cs:49 trace: [ExecuteAsync] Host provider 'Azure Repos' was selected.
23:04:03.025976 ...osHostProvider.cs:99 trace: [GetCredentialAsync] Looking for existing credential in store with service=https://msazure.visualstudio.com account=...
23:04:03.027806 ...edentialStore.cs:364 trace: [GetGpgPath] Using PATH-located GPG (gpg) executable: /usr/bin/gpg
23:04:03.030034 ...sHostProvider.cs:104 trace: [GetCredentialAsync] No existing credentials found.
23:04:03.030060 ...sHostProvider.cs:107 trace: [GetCredentialAsync] Creating new credential...
23:04:03.031275 ...sHostProvider.cs:226 trace: [GeneratePersonalAccessTokenAsync] Determining Microsoft Authentication Authority...
23:04:03.033184 ...eDevOpsRestApi.cs:43 trace: [GetAuthorityAsync] HTTP: HEAD https://msazure.visualstudio.com/
23:04:03.035509 ...pClientFactory.cs:60 trace: [CreateClient] Creating new HTTP client instance...
23:04:03.040089 ...pClientFactory.cs:80 trace: [CreateClient] Git's SSL/TLS backend is: OpenSsl
23:04:03.043140 git.c:455 trace: built-in: git version
23:04:03.049803 git.c:455 trace: built-in: git config --null --type=path http.https://msazure.visualstudio.com.sslCAInfo
23:04:03.051218 git.c:455 trace: built-in: git config --null --type=path http.msazure.visualstudio.com.sslCAInfo
23:04:03.052464 git.c:455 trace: built-in: git config --null --type=path http.https://visualstudio.com.sslCAInfo
23:04:03.053711 git.c:455 trace: built-in: git config --null --type=path http.visualstudio.com.sslCAInfo
23:04:03.054834 git.c:455 trace: built-in: git config --null --type=path http.sslCAInfo
23:04:03.056091 git.c:455 trace: built-in: git config --null --type=path http.https://msazure.visualstudio.com.cookieFile
23:04:03.057244 git.c:455 trace: built-in: git config --null --type=path http.msazure.visualstudio.com.cookieFile
23:04:03.058568 git.c:455 trace: built-in: git config --null --type=path http.https://visualstudio.com.cookieFile
23:04:03.059657 git.c:455 trace: built-in: git config --null --type=path http.visualstudio.com.cookieFile
23:04:03.060647 git.c:455 trace: built-in: git config --null --type=path http.cookieFile
23:04:03.294855 ...eDevOpsRestApi.cs:46 trace: [GetAuthorityAsync] HTTP: Response code ignored.
23:04:03.294901 ...eDevOpsRestApi.cs:47 trace: [GetAuthorityAsync] Inspecting headers...
23:04:03.329095 ...eDevOpsRestApi.cs:54 trace: [GetAuthorityAsync] Found WWW-Authenticate header with Bearer authority 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47'.
23:04:03.329725 ...sHostProvider.cs:228 trace: [GeneratePersonalAccessTokenAsync] Authority is 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47'.
23:04:03.329766 ...sHostProvider.cs:231 trace: [GeneratePersonalAccessTokenAsync] Getting Azure AD access token...
23:04:03.332480 ...uthentication.cs:132 trace: [GetTokenForUserAsync] OS broker is not available or enabled.
23:04:03.332507 ...uthentication.cs:138 trace: [GetTokenForUserAsync] MSA passthrough is enabled.
23:04:03.350355 ...uthentication.cs:562 trace: [RegisterTokenCacheAsync] Configuring MSAL token cache...
warning: cannot persist Microsoft authentication token cache securely!
23:04:03.379164 ...uthentication.cs:586 trace: [RegisterTokenCacheAsync] Cannot persist Microsoft Authentication data securely!
23:04:03.379369 ...uthentication.cs:587 trace: [RegisterTokenCacheAsync] ! error: 'Persistence check failed. Inspect inner exception for details'.
23:04:03.379397 ...uthentication.cs:587 trace: [RegisterTokenCacheAsync] > 'Unable to load shared library 'libsecret-1.so.0' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable:
/usr/local/share/gcm-core/libsecret-1.so.0: cannot open shared object file: No such file or directory
/usr/local/share/gcm-core/liblibsecret-1.so.0: cannot open shared object file: No such file or directory
/usr/local/share/gcm-core/libsecret-1.so.0.so: cannot open shared object file: No such file or directory
/usr/local/share/gcm-core/liblibsecret-1.so.0.so: cannot open shared object file: No such file or directory
'.
warning: using plain-text fallback token cache
23:04:03.379725 ...uthentication.cs:603 trace: [RegisterTokenCacheAsync] Using fall-back plaintext token cache on Linux.
23:04:03.380481 ...uthentication.cs:617 trace: [RegisterTokenCacheAsync] Token cache configured.
23:04:03.385726 ...uthentication.cs:244 trace: [GetTokenForUserAsync] Performing interactive auth with device code...
23:04:03.418089 ...pClientFactory.cs:60 trace: [CreateClient] Creating new HTTP client instance...
23:04:03.418204 ...pClientFactory.cs:80 trace: [CreateClient] Git's SSL/TLS backend is: OpenSsl
23:04:03.419535 git.c:455 trace: built-in: git config --null --type=path http.https://msazure.visualstudio.com.sslCAInfo
23:04:03.420940 git.c:455 trace: built-in: git config --null --type=path http.msazure.visualstudio.com.sslCAInfo
23:04:03.422121 git.c:455 trace: built-in: git config --null --type=path http.https://visualstudio.com.sslCAInfo
23:04:03.423179 git.c:455 trace: built-in: git config --null --type=path http.visualstudio.com.sslCAInfo
23:04:03.424413 git.c:455 trace: built-in: git config --null --type=path http.sslCAInfo
23:04:03.425724 git.c:455 trace: built-in: git config --null --type=path http.https://msazure.visualstudio.com.cookieFile
23:04:03.426848 git.c:455 trace: built-in: git config --null --type=path http.msazure.visualstudio.com.cookieFile
23:04:03.428259 git.c:455 trace: built-in: git config --null --type=path http.https://visualstudio.com.cookieFile
23:04:03.429321 git.c:455 trace: built-in: git config --null --type=path http.visualstudio.com.cookieFile
23:04:03.430388 git.c:455 trace: built-in: git config --null --type=path http.cookieFile
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code ANX9S9S6E to authenticate.
23:04:35.517987 ...sHostProvider.cs:239 trace: [GeneratePersonalAccessTokenAsync] Acquired Azure access token. Account='pmiller@microsoft.com' Token=''
23:04:35.518041 ...sHostProvider.cs:248 trace: [GeneratePersonalAccessTokenAsync] Creating Azure DevOps PAT with scopes 'vso.code_write, vso.packaging'...
23:04:35.519218 ...DevOpsRestApi.cs:117 trace: [CreatePersonalAccessTokenAsync] Getting Azure DevOps Identity Service endpoint...
23:04:35.520918 ...DevOpsRestApi.cs:167 trace: [GetIdentityServiceUriAsync] HTTP: GET https://msazure.visualstudio.com/_apis/ServiceDefinitions/LocationService2/951917AC-A960-4999-8464-E3F0AA25B381?api-version=1.0
23:04:35.546193 ...DevOpsRestApi.cs:171 trace: [GetIdentityServiceUriAsync] HTTP: Response 200 [OK]
23:04:35.549555 ...DevOpsRestApi.cs:119 trace: [CreatePersonalAccessTokenAsync] Identity Service endpoint is 'https://spsprodwus23.vssps.visualstudio.com/A41bf5486-7392-4b7a-a7e3-a735c767e3b3/'.
23:04:35.549591 ...DevOpsRestApi.cs:123 trace: [CreatePersonalAccessTokenAsync] HTTP: POST https://spsprodwus23.vssps.visualstudio.com/A41bf5486-7392-4b7a-a7e3-a735c767e3b3/_apis/token/sessiontokens?api-version=1.0&tokentype=compact
23:04:35.622823 ...DevOpsRestApi.cs:128 trace: [CreatePersonalAccessTokenAsync] HTTP: Response 200 [OK]
23:04:35.626120 ...sHostProvider.cs:253 trace: [GeneratePersonalAccessTokenAsync] PAT created. PAT='
'
23:04:35.626695 ...sHostProvider.cs:109 trace: [GetCredentialAsync] Credential created.
23:04:35.627123 ...nds/GetCommand.cs:39 trace: [ExecuteInternalAsync] Writing credentials to output:
23:04:35.627281 ...nds/GetCommand.cs:40 trace: [ExecuteInternalAsync] protocol=https
23:04:35.627309 ...nds/GetCommand.cs:40 trace: [ExecuteInternalAsync] host=msazure.visualstudio.com
23:04:35.627323 ...nds/GetCommand.cs:40 trace: [ExecuteInternalAsync] username=pmiller@microsoft.com
23:04:35.627337 ...nds/GetCommand.cs:40 trace: [ExecuteInternalAsync] password=********
23:04:35.627754 ...GitCommandBase.cs:53 trace: [ExecuteAsync] End 'get' command...
23:04:35.847488 run-command.c:668 trace: run_command: '/usr/local/bin/git-credential-manager store'
23:04:35.928624 git.c:455 trace: built-in: git config --null --list
23:04:35.968287 ...e/Application.cs:106 trace: [RunInternalAsync] Version: 2.5.1.0
23:04:35.974793 ...e/Application.cs:107 trace: [RunInternalAsync] Runtime: .NET 8.0.6
23:04:35.974830 ...e/Application.cs:108 trace: [RunInternalAsync] Platform: Linux (x86-64)
23:04:35.974842 ...e/Application.cs:109 trace: [RunInternalAsync] OSVersion: Ubuntu 22.04.4 LTS
23:04:35.974851 ...e/Application.cs:110 trace: [RunInternalAsync] AppPath: /usr/local/bin/git-credential-manager
23:04:35.974924 ...e/Application.cs:111 trace: [RunInternalAsync] InstallDir: /usr/local/share/gcm-core/
23:04:35.974958 ...e/Application.cs:112 trace: [RunInternalAsync] Arguments: store
23:04:35.999390 ...GitCommandBase.cs:32 trace: [ExecuteAsync] Start 'store' command...
23:04:36.015363 ...GitCommandBase.cs:46 trace: [ExecuteAsync] Detecting host provider for input:
23:04:36.016605 ...GitCommandBase.cs:47 trace: [ExecuteAsync] protocol=https
23:04:36.016642 ...GitCommandBase.cs:47 trace: [ExecuteAsync] host=msazure.visualstudio.com
23:04:36.016657 ...GitCommandBase.cs:47 trace: [ExecuteAsync] username=pmiller@microsoft.com
23:04:36.016715 ...GitCommandBase.cs:47 trace: [ExecuteAsync] password=********
23:04:36.019998 ...viderRegistry.cs:149 trace: [GetProviderAsync] Performing auto-detection of host provider.
23:04:36.022025 ...viderRegistry.cs:162 trace: [GetProviderAsync] Auto-detect probe timeout is 2 ms.
23:04:36.025677 ...viderRegistry.cs:170 trace: [GetProviderAsync] Checking against 4 host providers registered with priority 'Normal'.
23:04:36.026327 ...GitCommandBase.cs:49 trace: [ExecuteAsync] Host provider 'Azure Repos' was selected.
23:04:36.028067 ...sHostProvider.cs:148 trace: [StoreCredentialAsync] Storing credential with service=https://msazure.visualstudio.com account=pmiller@microsoft.com...
23:04:36.029885 ...edentialStore.cs:364 trace: [GetGpgPath] Using PATH-located GPG (gpg) executable: /usr/bin/gpg
fatal: Failed to encrypt file '/home/pmiller/.password-store/git/https/msazure.visualstudio.com/pmiller@microsoft.com.gpg' with gpg. exit=2, out=, err=gpg: whatever: skipped: No public key
gpg: [stdin]: encryption failed: No public key

at GitCredentialManager.Gpg.EncryptFile(String path, String gpgId, String contents)
at GitCredentialManager.Interop.Posix.GpgPassCredentialStore.SerializeCredential(FileCredential credential)
at GitCredentialManager.PlaintextCredentialStore.AddOrUpdate(String service, String account, String secret)
at GitCredentialManager.CredentialStore.AddOrUpdate(String service, String account, String secret)
at Microsoft.AzureRepos.AzureReposHostProvider.StoreCredentialAsync(InputArguments input)
at GitCredentialManager.Commands.StoreCommand.ExecuteInternalAsync(InputArguments input, IHostProvider provider)
at GitCredentialManager.Commands.GitCommandBase.ExecuteAsync()
at System.CommandLine.Invocation.AnonymousCommandHandler.InvokeAsync(InvocationContext context)
at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass15_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass19_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<b__18_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<b__5_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<b__0>d.MoveNext()
23:04:36.184766 run-command.c:668 trace: run_command: git fetch-pack --stateless-rpc --stdin --lock-pack --include-tag --thin https://msazure.visualstudio.com/DefaultCollection/CloudNativeCompute/_git/aks-rp/
23:04:36.186633 git.c:455 trace: built-in: git fetch-pack --stateless-rpc --stdin --lock-pack --include-tag --thin https://msazure.visualstudio.com/DefaultCollection/CloudNativeCompute/_git/aks-rp/
remote: Azure Repos
remote: Found 2976 objects to send. (3679 ms)
23:04:41.253825 run-command.c:668 trace: run_command: git index-pack --stdin -v --fix-thin '--keep=fetch-pack 3279296 on millercloud2' --pack_header=2,2976
23:04:41.255880 git.c:455 trace: built-in: git index-pack --stdin -v --fix-thin '--keep=fetch-pack 3279296 on millercloud2' --pack_header=2,2976
Receiving objects: 100% (2976/2976), 1.37 MiB | 14.06 MiB/s, done.
Resolving deltas: 100% (1693/1693), completed with 463 local objects.
23:04:41.760770 run-command.c:668 trace: run_command: git rev-list --objects --stdin --not --all --quiet --alternate-refs
23:04:41.762499 git.c:455 trace: built-in: git rev-list --objects --stdin --not --all --quiet --alternate-refs
From https://msazure.visualstudio.com/DefaultCollection/CloudNativeCompute/_git/aks-rp

The root cause of the hang seemed to be gpg-agent itself and I fixed with

gpgconf --kill gpg-agent
gpgconf --launch gpg-agent

But maybe git-credential manager should abort when pass returns no public key and timepout on pass/gpg being stuck?