在 Windows 和 WSL 之间共享 Git 凭据

在 Windows 和 WSL 之间共享 Git 凭据

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

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

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

只需按照以下步骤操作:

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

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

    arduino 复制代码
      git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/bin/git-credential-manager.exe"

要了解以前版本的路径git,请参考learn.microsoft.com/en-us/windo...

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


折腾使你进步!!!🤪

相关推荐
Vane Zhang13 分钟前
VirtualBox7.1.0 安装 Ubuntu22.04.5 虚拟机
linux
sysin.org14 分钟前
Ubuntu 22.04.5 LTS 发布下载 - 现代化的企业与开源 Linux
linux·ubuntu
MonkeyKing_sunyuhua15 分钟前
Ubuntu 中无法直接使用 `conda` 命令,设置conda的环境变量
linux·ubuntu·conda
小狮子安度因1 小时前
边缘智能-大模型架构初探
linux·网络
晨春计1 小时前
【git】
android·linux·git
Flying_Fish_roe1 小时前
linux-软件包管理-包管理工具(RedHat/CentOS 系)
linux·运维·centos
Splashtop高性能远程控制软件1 小时前
centos远程桌面连接windows
linux·windows·centos·远程控制·远程桌面
tang&1 小时前
【Linux】进程概念
linux
念幽2 小时前
Git常用命令
git
苏少朋2 小时前
Docker安装 ▎Docker详细讲解 ▎数据卷挂载 ▎Nginx安装理解
linux·nginx·docker·容器