跳过正文
  1. Posts/

在 Windows 和 WSL 之间共享 Git 凭据

·56 字·1 分钟· loading
windows windows wsl wsl2 ZSH
demo007x
作者
demo007x
windows - 这篇文章属于一个选集。
§ : 本文

在 Windows 和 WSL 之间共享 Git 凭据的封面图片

在 Windows 和 WSL 之间共享 Git 凭据
#

首先下载适用于 Windows 的 Git https://gitforwindows.org/ 并在安装步骤中选择 Git Credential Manager (GCM) 作为凭据帮助程序。

气相色谱法

如果你使用 HTTPS 克隆存储库,则可以与 WSL 共享此存储库,以便您输入的密码在双方都保留。

请注意,这不适用于使用 SSH 密钥。

只需按照以下步骤操作:

  1. 通过在Windows 命令提示符PowerShell中运行以下命令,在 Windows 上配置凭据管理器:

     git config --global credential.helper wincred
    
  2. 配置 WSL 以使用相同的凭据帮助程序,但在WSL 终端中运行以下命令(假设您有git>= v2.39.0):

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

要了解以前版本的路径git,请参考https://learn.microsoft.com/en-us/windows/wsl/tutorials/wsl-git

现在,WSL 可以使用您在 Windows 端使用 Git 时输入的任何密码,反之亦然。


折腾使你进步!!!🤪

windows - 这篇文章属于一个选集。
§ : 本文

相关文章

「wsl慢,wsl很慢」 如何解决 wsl 慢的问题?
windows windows wsl wsl2 ZSH
「wsl慢,wsl很慢」 如何解决 wsl 慢的问题?
ZSH!在 Windows 上使用 WSL+ZSH
windows windows wsl wsl2 ZSH
ZSH!在 Windows 上使用 WSL+ZSH
在 WSL 上升级 Ubuntu 版本
windows windows wsl wsl2
在 WSL 上升级 Ubuntu 版本