NPM 提示 error command git –no-replace-objects ls-remote ssh://xxx.xxx/xxx/xxx.git问题的解决方案

前言

今天在部署 OpenClaw 的时候,在使用 npm 下载该项目时,提示如下图的错误提示

图片[1]-NPM 提示 error command git –no-replace-objects ls-remote ssh://xxx.xxx/xxx/xxx.git问题的解决方案-资源刺客

通常是因为项目依赖中包含了 Git SSH 地址的包,但你的环境无法通过 SSH 拉取代码导致的。常见于网络限制、SSH 密钥未配置或 Git 未安装等情况。

解决方案

我们需要执行下面的代码来解决!

首先右键单击 开始 菜单,选择 Windows PowerShell (管理员) 菜单选项。

图片[2]-NPM 提示 error command git –no-replace-objects ls-remote ssh://xxx.xxx/xxx/xxx.git问题的解决方案-资源刺客

在终端中输入下面的命令!

git config --global url."https://".insteadOf ssh://git@github.com/
图片[3]-NPM 提示 error command git –no-replace-objects ls-remote ssh://xxx.xxx/xxx/xxx.git问题的解决方案-资源刺客

执行完成后,我们还需要使用下面的命令来清除 NPM 的缓存!

npm cache clean --force
图片[4]-NPM 提示 error command git –no-replace-objects ls-remote ssh://xxx.xxx/xxx/xxx.git问题的解决方案-资源刺客

最后,我们重新执行我们的下载命令来进行测试是否成功!

© 版权声明
THE END
喜欢就支持一下吧
点赞8 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容