简体   繁体   中英

How do I fix git-credential-manager issue in WSL2?

I am using ubuntu 20.04 on Windows 10 with WSL2. Recently, I am finding it difficult to git push origin to my repo. It always return this error

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

After, it asks for my github username and password, it still returns the above error with an addition ' Everything up-to-date '.

/mnt/c/Program\ Files/Git/mingw64/libexec/git-core/git-credential-manager.exe store: 1: /mnt/c/Program Files/Git/mingw64/libexec/git-core/git-credential-manager.exe: not found Everything up-to-date

I have tried this solution below, but it is not working also.

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

How do I fix this issue please?

Run as WSL2/root:

file=/usr/bin/git-credential-manager
echo 'exec "/c/Program Files/git/mingw64/libexec/git-core/git-credential-manager.exe" $@' > $file
chmod +x $file

then run as normal user (ubuntu for example)

cat << EOF >> ~/.gitconfig
[credential]
    helper = manager
EOF

Adding @skinnedpanda's comment as an answer.

Run this in git bash:

git config --global credential.helper store

The git credential manager path is changed in newer git versions. So in wsl set new path of credential.helper with:

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

git/mingw64/libexec/git-core/git-credential-manager-core.exe is changed to Git/mingw64/bin/git-credential-manager-core.exe

Source: https://github.com/microsoft/WSL/issues/8395

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM