欢迎光临
我们一直在努力

git 没有 SSH 密钥,无法通过 SSH 访问 GitHub。

Madama香港龙: 03-13 15:12:45
很好!问题很明确:git 没有 SSH 密钥,无法通过 SSH 访问 GitHub。

🔑 解决方案(选一个就行)

方案1:使用 HTTPS 代替 SSH(最简单!)
在 PowerShell 中运行:

配置 git 使用 HTTPS 而不是 SSH
git config global url."https://github.com/".insteadOf git@github.com:
git config global url."https://".insteadOf git://

清理缓存后重试
npm cache clean force
npm install openclaw g

方案2:配置 Git 凭据管理器

启用 git 凭据管理器
git config global credential.helper manager

然后运行安装
npm install openclaw g

方案3:生成 SSH 密钥(如果你有 GitHub 账户)

1. 生成 SSH 密钥
ssh-keygen t ed25519 C "your_email@example.com"

按 Enter 接受默认路径

2. 启动 ssh-agent
Start-Service ssh-agent


Set-Service Name ssh-agent StartupType Automatic
Start-Service ssh-agent

3. 添加密钥
ssh-add ~/.ssh/id_ed25519

4. 复制公钥到剪贴板
cat ~/.

Madama香港龙: 03-13 15:12:57
ssh/id_ed25519.pub | clip

5. 将公钥添加到 GitHub: https://github.com/settings/keys

方案4:临时跳过 git 使用代理

设置 npm 的 git 协议为 https
npm config set git "https://github.com/"

或完全跳过 git
npm install openclaw g verbose ignore-scripts

🚀 推荐步骤:

1. 先让 git 能用(如果还没修复)
$env:Path = "C:\\Program Files\\Git\\cmd;" + $env:Path

2. 配置 git 使用 HTTPS
git config global url."https://github.com/".insteadOf git@github.com:
git config global credential.helper manager

3. 验证配置
git config global list | findstr url

4. 清理并重试
npm cache clean force
npm install openclaw g verbose

📝 如果还不行,试试这个完整命令:

一次性命令
npm install openclaw g registry=https://registry.npmjs.org/ verbose

先试试方案1(最简单),如果还不行,告诉我错误信息,我们再想其他办法!

赞(0)
未经允许不得转载:171主机测评 » git 没有 SSH 密钥,无法通过 SSH 访问 GitHub。
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址