ImB*_*IOS 10 git github windows-subsystem-for-linux git-credential-manager wsl-2
/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
Run Code Online (Sandbox Code Playgroud)
我发现这个问题,然后每当我从本地 WSL2 环境中使用 GitHub 远程存储库进行 git 活动时,git 都会要求我提供用户名和密码,以便向 GitHub 进行身份验证。
每次都这样做很烦人,然后我搜索并遵循我在互联网上可以找到的几个教程,但一切都让我再次遇到同样的问题,这些教程根本不能解决我的问题。
每个教程都告诉我应该为WSL2环境中的git添加Windows环境中的GCM目录。理论上,它应该可以解决我的问题,但事实并非如此。
ImB*_*IOS 27
如果您的 git 文件夹中没有git-credential-core.exe,则使用它而不是git-credential-wincred.exe. 不-core存在可执行文件,因此我使用该-wincred文件。
在 WSL2 上执行此命令(如果存在则使用-core而不是):-wincred
git config --global credential.helper "/mnt/c/Program\\ Files/Git/mingw64/libexec/git-core/git-credential-core.exe"\nRun Code Online (Sandbox Code Playgroud)\n仅当上述命令 \xe2\x9d\x8c 失败或没有解决问题时,才更改为-wincred
git config --global credential.helper "/mnt/c/Program\\ Files/Git/mingw64/libexec/git-core/git-credential-wincred.exe"\nRun Code Online (Sandbox Code Playgroud)\n我认为git-credential-manager-core.exe已经被重命名git-credential-wincred.exe,但是互联网上的许多教程已经被弃用,因为他们给了我们这个可执行文件的旧名称。这是我最大的问题,因为随着时间的推移,遵循任何教程都会让我发现同样的错误。
小智 13
当我将 Windows 版 Git 升级到最新版本之一(我认为是 2.37.0)时,我在 Windows 10 的 WSL2 上遇到了类似的问题。这是因为 git-credential-manager-core.exe 已移至其他文件夹。
解决方案:
要解决此问题,请从 bash 命令行运行以下命令:
git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/bin/git-credential-manager-core.exe"
注意:如果您将 Git 安装在不同的驱动器/文件夹中 - 相应地更新路径。