Git Credential Manager Not Found on WSL2

Viewed 1310

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.

3 Answers

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.

Solution

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

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

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 to 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 just makes me find the same error over time.

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 = 'name.user@email.mx'
[credential https://myrepo.azure.com"]
    useHttpPath = true


Related