在 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 时输入的任何密码,反之亦然。


折腾使你进步!!!🤪

相关推荐
权咚12 小时前
阿权的开发经验小集
git·ios·xcode
轻松Ai享生活19 小时前
5 节课深入学习Linux Cgroups
linux
christine-rr19 小时前
linux常用命令(4)——压缩命令
linux·服务器·redis
三坛海会大神55519 小时前
LVS与Keepalived详解(二)LVS负载均衡实现实操
linux·负载均衡·lvs
東雪蓮☆19 小时前
深入理解 LVS-DR 模式与 Keepalived 高可用集群
linux·运维·服务器·lvs
乌萨奇也要立志学C++20 小时前
【Linux】进程概念(二):进程查看与 fork 初探
linux·运维·服务器
獭.獭.1 天前
Linux -- 信号【上】
linux·运维·服务器
hashiqimiya1 天前
centos配置环境变量jdk
linux·运维·centos
hashiqimiya1 天前
权限更改centos中系统文件无法创建文件夹,使用命令让普通用户具备操作文件夹
linux
路由侠内网穿透1 天前
本地部署 GPS 跟踪系统 Traccar 并实现外部访问
运维·服务器·网络·windows·tcp/ip