方案一:修改 Git 全局配置(最简单)
# 1. 设置 Git 全局使用 SSH 代替 HTTPS
git config --global url."[email protected]:".insteadOf "https://github.com/"
# 2. 设置 SSH 命令使用您的密钥
git config --global core.sshCommand "ssh -i %USERPROFILE%\.ssh\id_ed25519"
# 3. 验证配置
git config --global --list | findstr "insteadof|sshCommand"
优点:配置简单,一键完成 缺点:所有仓库使用同一密钥
方案二:创建 SSH 配置文件(最推荐)
- 创建或编辑 SSH 配置文件:text 文件位置

