Git 要求输入密码以在 WSL 2 (Ubuntu) 上推送,但在 Windows 上则不需要。这是为什么?
Git asks for password to push on WSL 2 (Ubuntu), but not on Windows. Why is that?
我不知道为什么会这样。当我尝试在 Ubuntu (WSL 2) 上推送任何内容时,git 不断询问我的用户名和密码,但是当我在 Windows 上通过 bash 推送内容时 git 不要求任何凭据,我可以直接推送。我是 WS2L 和 Ubuntu 的新手,所以我不知道这是正常现象还是有问题。
从 Docs,您可以 link Git 凭据管理器到 WSL
git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/libexec/git-core/git-credential-manager.exe"
至于“为什么”,是因为现在您的 WSL 中的 git 和 Windows 使用不同的凭据存储。
我不知道为什么会这样。当我尝试在 Ubuntu (WSL 2) 上推送任何内容时,git 不断询问我的用户名和密码,但是当我在 Windows 上通过 bash 推送内容时 git 不要求任何凭据,我可以直接推送。我是 WS2L 和 Ubuntu 的新手,所以我不知道这是正常现象还是有问题。
从 Docs,您可以 link Git 凭据管理器到 WSL
git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/libexec/git-core/git-credential-manager.exe"
至于“为什么”,是因为现在您的 WSL 中的 git 和 Windows 使用不同的凭据存储。