git-credential-manager icon indicating copy to clipboard operation
git-credential-manager copied to clipboard

fatal: helper error (139) with Github.UI on WSL 2

Open panjiesw opened this issue 2 years ago • 7 comments

Version

2.0.886+ea93cb5158

Operating system

Other - please describe below

OS version or distribution

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.2 LTS
Release:        22.04
Codename:       jammy

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 am authenticated and my Git operation completes successfully.

Actual behavior

got error: fatal: helper error (139): Unknown when choosing any options in the Github.UI prompt (Sign in with your browser, Sign in with a code, personal access token).

Logs

This the same as #911, which is closed due to lack of response from the author.

I'm using git-credential-manager on Ubuntu 20.04 on WSL2 with details

> wsl.exe -v
WSL version: 1.0.3.0
Kernel version: 5.15.79.1
WSLg version: 1.0.47
MSRDC version: 1.2.3575
Direct3D version: 1.606.4
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19044.2486

Trace result

$ WSLENV=$WSLENV:GCM_TRACE:GIT_TRACE GCM_TRACE=1 GIT_TRACE=1 git clone https://github.com/panjiesw/std-test.git
09:50:24.884035 git.c:439               trace: built-in: git clone https://github.com/panjiesw/std-test.git
Cloning into 'std-test'...
09:50:24.894633 run-command.c:663       trace: run_command: git-remote-https origin https://github.com/panjiesw/std-test.git
09:50:25.232837 run-command.c:663       trace: run_command: '/usr/local/bin/git-credential-manager get'
09:50:25.436632 ...re/Application.cs:95 trace: [RunInternalAsync] Version: 2.0.886.37866
09:50:25.439755 ...re/Application.cs:96 trace: [RunInternalAsync] Runtime: .NET 6.0.11
09:50:25.439770 ...re/Application.cs:97 trace: [RunInternalAsync] Platform: Linux (x86-64)
09:50:25.439794 ...re/Application.cs:98 trace: [RunInternalAsync] OSVersion: Linux panjie-s01 5.15.79.1-microsoft-standard-WSL2 #1 SMP Wed Nov 23 01:01:46 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
09:50:25.439837 ...re/Application.cs:99 trace: [RunInternalAsync] AppPath: /usr/local/bin/git-credential-manager
09:50:25.439885 ...e/Application.cs:100 trace: [RunInternalAsync] InstallDir: /usr/local/share/gcm-core/
09:50:25.439937 ...e/Application.cs:101 trace: [RunInternalAsync] Arguments: get
09:50:25.478295 ...GitCommandBase.cs:33 trace: [ExecuteAsync] Start 'get' command...
09:50:25.486829 ...GitCommandBase.cs:47 trace: [ExecuteAsync] Detecting host provider for input:
09:50:25.489044 ...GitCommandBase.cs:48 trace: [ExecuteAsync]   protocol=https
09:50:25.489085 ...GitCommandBase.cs:48 trace: [ExecuteAsync]   host=github.com
09:50:25.499863 ...viderRegistry.cs:149 trace: [GetProviderAsync] Performing auto-detection of host provider.
09:50:25.502739 ...viderRegistry.cs:162 trace: [GetProviderAsync] Auto-detect probe timeout is 2 ms.
09:50:25.504683 ...viderRegistry.cs:170 trace: [GetProviderAsync] Checking against 4 host providers registered with priority 'Normal'.
09:50:25.505387 ...GitCommandBase.cs:50 trace: [ExecuteAsync] Host provider 'GitHub' was selected.
09:50:25.506762 .../HostProvider.cs:126 trace: [GetCredentialAsync] Looking for existing credential in store with service=https://github.com account=...
09:50:25.572804 ...edentialStore.cs:352 trace: [GetGpgPath] Using PATH-located GPG (gpg) executable: /usr/bin/gpg
09:50:25.575461 .../HostProvider.cs:131 trace: [GetCredentialAsync] No existing credentials found.
09:50:25.575515 .../HostProvider.cs:134 trace: [GetCredentialAsync] Creating new credential...
09:50:25.580015 ...bHostProvider.cs:255 trace: [GetSupportedAuthenticationModesAsync] https://github.com/ is github.com - authentication schemes: 'Pat, OAuth'
09:50:25.592775 ...nticationBase.cs:150 trace: [TryFindHelperCommand] Using default UI helper: 'GitHub.UI'.
09:50:25.592833 ...nticationBase.cs:181 trace: [TryFindHelperCommand] Found in-box native UI helper: '/usr/local/share/gcm-core/GitHub.UI'
09:50:25.593756 ...enticationBase.cs:40 trace: [InvokeHelperAsync] Starting helper process: /usr/local/share/gcm-core/GitHub.UI prompt --browser --device --pat
fatal: helper error (139): Unknown
   at GitCredentialManager.Authentication.AuthenticationBase.InvokeHelperAsync(String path, String args, IDictionary`2 standardInput, CancellationToken ct)
   at GitHub.GitHubAuthentication.GetAuthenticationAsync(Uri targetUri, String userName, AuthenticationModes modes)
   at GitHub.GitHubHostProvider.GenerateCredentialAsync(InputArguments input)
   at GitCredentialManager.HostProvider.GetCredentialAsync(InputArguments input)
   at GitCredentialManager.Commands.GetCommand.ExecuteInternalAsync(InputArguments input, IHostProvider provider)
   at GitCredentialManager.Commands.GitCommandBase.ExecuteAsync()
   at System.CommandLine.Invocation.CommandHandler.GetExitCodeAsync(Object value, InvocationContext context)
   at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass23_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass27_0.<<UseVersionOption>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass25_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__24_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass11_0.<<UseDebugDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__10_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass14_0.<<UseExceptionHandler>b__0>d.MoveNext()
Username for 'https://github.com':

Running command suggested in https://github.com/GitCredentialManager/git-credential-manager/issues/911#issuecomment-1286233299. The prompt was shown but got Segmentation fault after choosing any options.

$ GCM_TRACE=1 /usr/local/share/gcm-core/GitHub.UI prompt --browser --device --pat
mode=browser

Segmentation fault

Result of git credential-manager-core diagnose: gcm-diagnose.log

I haven't run strace mentioned in https://github.com/GitCredentialManager/git-credential-manager/issues/911#issuecomment-1280362285, let me know if it's needed.

panjiesw avatar Feb 25 '23 03:02 panjiesw

Update: I disabled the gui prompt and I got it working. Seems like the issue in the gui prompt.

git config --global credential.guiPrompt false

panjiesw avatar Feb 25 '23 03:02 panjiesw

What version/build number of Windows are you running? You can find the build number by running ver at a command prompt.

ldennington avatar Feb 27 '23 22:02 ldennington

@ldennington running ver command showed this

Microsoft Windows [Version 10.0.19044.2486]

panjiesw avatar Mar 08 '23 15:03 panjiesw

Please try the following and report whether the issue repros:

  1. Update to the latest version of Windows 10.
  2. Create a new WSL2 distro using the latest version of Ubuntu (22.04).

ldennington avatar Mar 27 '23 21:03 ldennington

Update: I disabled the gui prompt and I got it working. Seems like the issue in the gui prompt.

git config --global credential.guiPrompt false

This has worked for me too. git push let me select my web browser for authentication. I think this should also be the default feature of git-credential-manager instead of the small GUI window.

songyang-dev avatar Mar 30 '23 23:03 songyang-dev

Please try the following and report whether the issue repros:

1. Update to the latest version of Windows 10.

2. Create a new WSL2 distro using the latest version of Ubuntu (22.04).

@ldennington I'm on a company managed laptop and already using latest updates. Will retry when there's a new update. Regarding WSL2 distro, I'm in fact using Ubuntu 22.04, it's a mistake in my issue description, ~~will confirm again when available~~. I've updated the description to change the Ubuntu version

panjiesw avatar Mar 31 '23 15:03 panjiesw

I'm now seeing the same problem (it worked previously and I don't think I've change anything):

❯ /opt/mambaforge/envs/base/share/gcm-core/GitHub.UI prompt --browser --device --pat
mode=browser

Segmentation fault

WSL running on Windows 11

❯ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.2 LTS
Release:        22.04
Codename:       jammy

Windows 11 Enterprise 22H2 OS Build 22621.1413 Windows Feature Experience Pack 1000.22639.1000.0

git config --global credential.guiPrompt false

Does work around the issue :/

dhirschfeld-shell avatar Apr 26 '23 00:04 dhirschfeld-shell