Git Credential Manager Not Found on WSL2
Asked Answered
T

7

17

Error Message

/mnt/c/Program\ Files/Git/mingw64/libexec/git-core/git-credential-manager-core.exe get: 1: /mnt/c/Program Files/Git/mingw64/libexec/git-core/git-credential-manager-core.exe: not found

Problem Story

I found this problem then git ask me for a username and password to authenticate to GitHub whenever I'm doing git activity with GitHub remote repository from my local WSL2 environment.

It is very annoying to do this every time, then I search and follow several tutorials I can find on the internet, but everything just led me to the same problem again, these tutorial is not solving my problem at all.

Every tutorial tells me that I should add the GCM directory in the Windows environment for the git in the WSL2 environment. Theoretically, it should solve my problem, but it is not.

Trug answered 2/6, 2022 at 7:42 Comment(0)
T
36

Solution

If there is no git-credential-core.exe in your git folder, then use it instead of the git-credential-wincred.exe. No -core executable file exists, so I use the -wincred file.

Execute this command on WSL2 (use the -core rather than -wincred if it exists):

git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/libexec/git-core/git-credential-core.exe"

only if the above command ❌ fails or does not solve the problem, change to -wincred

git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/libexec/git-core/git-credential-wincred.exe"

Explanation

I think git-credential-manager-core.exe has already been renamed git-credential-wincred.exe, but many tutorials on the internet are already deprecated because they gave us the old name of this executable file. This is my biggest problem because following any tutorial makes me find the same error over time.

Trug answered 2/6, 2022 at 7:42 Comment(6)
this have not worked for me. Using "-wincred" throws some error I have unfortunatelly not saved. It needs to be the "-core" one, this works like a charm (the other answer).Methodical
@JanVilimek you should check your git version first, in the newer version it uses -wincred. in the older version it uses -coreTrug
I am using 2.37.0 and the error was probably <3>init: (30629) ERROR: UtilConnectToInteropServer:307: connect failed 2 ... as now I am getting the same error even while using the -core version :/ UPDATE: the error occurs only in vscode...when running from a console (WSL/bash), its working...Methodical
@JanVilimek you can ask a new question for it, and please provide the detail, like whether the vscode terminal is using the gitcred from windows or not.Trug
thank you ! It works for me , feels painful to use linux with window :(Physical
@Physical Yeah, It's a lot of painful to use WSL2, in my experience I would recommend any of my friend to use native windows instead of using WSL2, or just get a macOS or native Linux installed. Just.. don't half hearted when we do something, do it with all of our hand.Trug
P
15

I faced a similar issue on WSL2 with Windows 10 when I upgraded Git for Windows to one of the recent versions (2.37.0 I think). This is because the git-credential-manager-core.exe has been moved to a different folder.

Solution:

To fix this issue, run the following command from your bash command line:

git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/bin/git-credential-manager-core.exe"

Note: If you have Git installed in a different drive/folder - update the path accordingly.

Psychosomatic answered 28/6, 2022 at 12:7 Comment(3)
nice! that's the correct path. Thanks!Methodical
git-credential-manager-core.exe has been renamed to git-credential-manager.exe (no -core)Castroprauxel
where is git-credential-manager.exe? I don't have that exe, I just have git-credential-store and git-credential-wincredElwell
J
3

It's very frustrating that configuring git on WSL2 seems to be constantly evolving and you need to sift through so many obsolete solutions before stumbling upon the one that works. Each time my token has expired, I was not able to simply replace it with a new one.

Make sure your Git for Windows and Git in WSL2 are the same version.

For me, authenticating with a GitHub personal access token was solved by:

[credential]
helper = /mnt/c/Program\\ Files/Git/mingw64/bin/git-credential-manager.exe
credentialStore = wincred

Note: git-credential-manager.exe. Not git-credential-manager-core.exe (which is obsolete). Not a 32-bit version. Not git-credential-wincred.exe.

Note 2: I saw some answers with: helper = . This did not work for me. I had to remove it.

Jumper answered 14/2, 2023 at 18:28 Comment(0)
D
3

This was helpful for me in solving it. https://github.com/GitCredentialManager/git-credential-manager/blob/main/docs/rename.md

I edited my

~/.config

This was the OLD

helper = /mnt/c/Program\Files/Git/mingw64/bin/git-credential-manager-core.exe

This is the NEW

helper =

helper = /mnt/c/Program\ Files/Git/mingw64/bin/git-credential-manager.exe

There is a blank helper on purpose. See the link above.

Delanadelancey answered 20/2, 2023 at 22:24 Comment(0)
L
1

I experienced the same problem using wsl2 with git version 2.34.1 installed both on windows and wsl and turns out they have moved the git-credential-manager-core.exe file... use this command ...

git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/libexec/git-core/git-credential-manager-core.exe"
Leviticus answered 3/2, 2023 at 9:10 Comment(0)
R
0

I had the same problem, what I did was identify the file: C:/Users/name.user/.gitconfig

I open it with a text edit and did the following

--DELETE

[credential]
    helper = wincred
    helper = 
    helper = C:/Program\\ Files/Git/mingw64/libexec/git-core/git-credential-manager-core.exe
-------

--Change correct repo
[credential "https://xyz.azure.com"]
------
Result:
[user]
    name = 'name.user'
    email = '[email protected]'
[credential https://myrepo.azure.com"]
    useHttpPath = true


Rikkiriksdag answered 2/9, 2022 at 16:48 Comment(0)
C
0

I experienced similar issues as well, with WSL 2 and fresh install of Git for Windows 2.38.1.

Turned out the path I got from the tutorials was wrong for me. In my case the correct command was:

git config --global credential.helper "/mnt/c/Program\ Files\ \(x86\)/Git/mingw32/libexec/git-core/git-credential-wincred.exe"
Cheltenham answered 11/12, 2022 at 17:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.