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

Using Windows exe from WSL is failing with "Invalid Argument" #1278

Closed
jghal opened this issue Jun 1, 2023 · 5 comments
Closed

Using Windows exe from WSL is failing with "Invalid Argument" #1278

jghal opened this issue Jun 1, 2023 · 5 comments
Labels
auth-issue An issue authenticating to a host external Relating to an external partner, team, or library platform:wsl Specific to Windows Subsystem for Linux

Comments

@jghal
Copy link

jghal commented Jun 1, 2023

Version

2.0.935+8b4735fc7b

Operating system

Windows

OS version or distribution

Windows 10 Enterprise, WSL2 Ubuntu 20.04

Git hosting provider(s)

Other - please describe below

Other hosting provider

Both Azure DevOps and GitLab

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

https://dev.azure.com/{org}

Can you access the remote repository directly in the browser?

Yes, I can access the repository

Expected behavior

I expect the git operations from Linux to complete using the authentication stored in Windows Credential Manager, the same as it does when running the same operations from PowerShell.

Actual behavior

I see the error message

/mnt/c/Program Files/Git/mingw64/bin/git-credential-manager.exe: Invalid argument

followed by a prompt for username and password. Entering the username and password does not store credentials and I am again prompted for every git operation.

Logs

Running from PowerShell

> git credential-manager diagnose
Running diagnostics...

 [ OK ] Environment
 [ OK ] File system
 [ OK ] Networking
 [ OK ] Git
 [ OK ] Credential storage
 [ OK ] Microsoft authentication (AAD/MSA)
 [ OK ] GitHub API

Diagnostic summary: 7 passed, 0 skipped, 0 failed.
Log files:
  C:\Users\jg\gcm-diagnose.log

Caution: Log files may include sensitive information - redact before sharing.

> git ls-remote https://dev.azure.com/myorg/myproject/_git/terraform-azure-vpn-appliance
10:26:37.886748 exec-cmd.c:237          trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
10:26:37.927752 git.c:439               trace: built-in: git ls-remote https://dev.azure.com/myorg/myproject/_git/terraform-azure-vpn-appliance
10:26:37.940768 run-command.c:655       trace: run_command: git remote-https https://dev.azure.com/myorg/myproject/_git/terraform-azure-vpn-appliance https://dev.azure.com/myorg/myproject/_git/terraform-azure-vpn-appliance
10:26:37.988749 exec-cmd.c:237          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
10:26:37.993745 git.c:725               trace: exec: git-remote-https https://dev.azure.com/myorg/myproject/_git/terraform-azure-vpn-appliance https://dev.azure.com/myorg/myproject/_git/terraform-azure-vpn-appliance
10:26:37.995744 run-command.c:655       trace: run_command: git-remote-https https://dev.azure.com/myorg/myproject/_git/terraform-azure-vpn-appliance https://dev.azure.com/myorg/myproject/_git/terraform-azure-vpn-appliance
10:26:38.185744 exec-cmd.c:237          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
10:26:38.433767 run-command.c:655       trace: run_command: 'git credential-manager get'
10:26:38.698742 exec-cmd.c:237          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
10:26:38.702748 git.c:725               trace: exec: git-credential-manager get
10:26:38.702748 run-command.c:655       trace: run_command: git-credential-manager get
10:26:39.488744 ...\Application.cs:95   trace: [RunInternalAsync] Version: 2.0.935.18315
10:26:39.500742 ...\Application.cs:96   trace: [RunInternalAsync] Runtime: .NET Framework 4.0.30319.42000
10:26:39.500742 ...\Application.cs:97   trace: [RunInternalAsync] Platform: Windows (x86-64)
10:26:39.500742 ...\Application.cs:98   trace: [RunInternalAsync] OSVersion: 10.0 (build 19045)
10:26:39.500742 ...\Application.cs:99   trace: [RunInternalAsync] AppPath: C:\Program Files\Git\mingw64\bin\git-credential-manager
10:26:39.501742 ...\Application.cs:100  trace: [RunInternalAsync] InstallDir: C:\Program Files\Git\mingw64\bin\
10:26:39.501742 ...\Application.cs:101  trace: [RunInternalAsync] Arguments: get
10:26:39.575747 ...GitCommandBase.cs:33 trace: [ExecuteAsync] Start 'get' command...
[redacted because it works as expected]

Running git ls-remote from WSL

$ git config --get credential.helper
/mnt/c/Program\ Files/Git/mingw64/bin/git-credential-manager.exe
$ git config --get credential.https://dev.azure.com.useHttpPath
true
$ WSLENV=$WSLENV:GCM_TRACE:GIT_TRACE GCM_TRACE=1 GIT_TRACE=1 git ls-remote
10:16:45.299929 git.c:439               trace: built-in: git ls-remote
10:16:45.300265 run-command.c:655       trace: run_command: GIT_DIR=.git git remote-https origin https://dev.azure.com/myorg/myproject/_git/terraform-azure-vpn-appliance
10:16:45.302347 git.c:725               trace: exec: git-remote-https origin https://dev.azure.com/myorg/myproject/_git/terraform-azure-vpn-appliance
10:16:45.306861 run-command.c:655       trace: run_command: git-remote-https origin https://dev.azure.com/myorg/myproject/_git/terraform-azure-vpn-appliance
10:16:45.822946 run-command.c:655       trace: run_command: '/mnt/c/Program\ Files/Git/mingw64/bin/git-credential-manager.exe get'
/mnt/c/Program Files/Git/mingw64/bin/git-credential-manager.exe: Invalid argument
Username for 'https://dev.azure.com/myorg/myproject/_git/terraform-azure-vpn-appliance':
@jghal jghal added the auth-issue An issue authenticating to a host label Jun 1, 2023
@bevin0708
Copy link

I have a similar issue. WSL on Windows 10

$ git pull
/mnt/c/Users/name/AppData/Local/Programs/Git/GCM/gcmuser-win-x86-2.1.2.exe: Invalid argument

@ldennington
Copy link
Contributor

@jghal - what happens if, from inside WSL, you run /mnt/c/Program\ Files/Git/mingw64/bin/git-credential-manager.exe --help?

@jghal
Copy link
Author

jghal commented Jun 5, 2023

Here is the output.

$ /mnt/c/Program\ Files/Git/mingw64/bin/git-credential-manager.exe --help
/mnt/c/Program Files/Git/mingw64/bin/git-credential-manager.exe: Invalid argument
                                                                                 $

@mjcheetham
Copy link
Collaborator

Hmm.. this appears to be a wider error/issue with WSL itself: microsoft/WSL#6170

I'm not sure what we can do here to fix the underlying issue with the WSL/Windows interop.

@mjcheetham mjcheetham closed this as not planned Won't fix, can't repro, duplicate, stale Jun 12, 2023
@mjcheetham mjcheetham added external Relating to an external partner, team, or library platform:wsl Specific to Windows Subsystem for Linux labels Jun 12, 2023
@jghal
Copy link
Author

jghal commented Jun 12, 2023

Thanks for the link @mjcheetham. It's strange because that issue is years old and this only just started for me. Regardless, Sublime1's comment proved useful to me. Running wsl --shutdown from PowerShell, and then starting a new Ubuntu shell in Terminal seemed to clear it up and it's working again.

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 external Relating to an external partner, team, or library platform:wsl Specific to Windows Subsystem for Linux
Projects
None yet
Development

No branches or pull requests

4 participants