当前位置:首页 » 《关于电脑》 » 正文

错误code128:npm ERR! An unknown git error occurred command git --no-replace-objects ls-remote ssh://

12 人参与  2024年05月08日 13:55  分类 : 《关于电脑》  评论

点击全文阅读


目录

一、遇到问题

二、出现问题的原因 

三、解决办法

四、类似的错误


一、遇到问题

在使用命令npm install下载依赖项的时候就遇到了这个问题,切换了国内的淘宝源也下载不了。

npm ERR! code 128npm ERR! An unknown git error occurrednpm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/nhn/raphael.gitnpm ERR! git@github.com: Permission denied (publickey).npm ERR! fatal: Could not read from remote repository.npm ERR!npm ERR! Please make sure you have the correct access rightsnpm ERR! and the repository exists.npm ERR! A complete log of this run can be found in:npm ERR!     D:\IT_base\node16\node_cache\_logs\2023-09-16T05_03_02_827Z-debug-0.log

二、出现问题的原因 

 git上面拉取东西时候出现了问题

三、解决办法

1.项目里面执行这个命令

git config --global url."https://".insteadOf ssh://git@

 这个命令的作用是将 Git 在使用 SSH 克隆(或拉取)仓库时的默认 URL 协议从 SSH 更改为 HTTPS。这是一个 Git 的配置设置,它可以对你的 Git 操作产生影响。

通常情况下,当你使用 SSH 协议克隆或拉取 Git 仓库时,URL 的格式是 ssh://git@github.com/username/repo.git,其中 git@github.com 是 SSH URL。但有时,你可能希望将 Git 操作重定向到使用 HTTPS 协议,例如 https://github.com/username/repo.git,这样可以避免 SSH 密钥的设置和管理。

使用 git config 命令设置 url."https://".insteadOf ssh://git@ 后,Git 将默认使用 HTTPS 协议而不是 SSH 协议来访问远程仓库,以便执行克隆、拉取等操作。这对于那些不想或不需要使用 SSH 密钥的情况非常有用。

注意,这个配置是全局配置,会影响你系统中的所有 Git 仓库。如果你只想在特定仓库中使用 HTTPS 协议,你可以在该仓库的 .git/config 文件中进行配置,而不是全局配置。

2.执行下载依赖项的命令

npm install

这样依赖项就下载成功了

 

四、类似的错误

解决npm install遇到的问题:Error while executing:_云边的快乐猫的博客-CSDN博客


点击全文阅读


本文链接:http://zhangshiyu.com/post/105149.html

<< 上一篇 下一篇 >>

  • 评论(0)
  • 赞助本站

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

关于我们 | 我要投稿 | 免责申明

Copyright © 2020-2022 ZhangShiYu.com Rights Reserved.豫ICP备2022013469号-1