Git 代理 和 npm error code 128

设置 git 代理

端口自行更改, 这里以clash为例

git config --global http.proxy http://127.0.0.1:7890
git config --global https.proxy https://127.0.0.1:7890

清空 git 代理

git config --global --unset http.proxy

git config --global --unset https.proxy

npm 清空缓存

npm config delete proxy

npm 删除代理

npm config delete proxy

npm128 报错

npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/adobe-webplatform/eve.git
npm 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 rights
npm ERR! and the repository exists.

npm ERR! A complete log of this run can be found in:
npm ERR!     D:\Develo\nodejs\node_cache\_logs\2022-02-23T03_34_18_949Z-debug-0.log

使用下面的命令,达到,把地址里的 ssh://git@ 换成 https:// 的目的
git config --global url."https://".insteadOf ssh://git@
这个是 备选的写法 没试过
git config --global url."https://".insteadOf git://

但是,以ssh://git@github.com/nhn/raphael.git为例,你在浏览器 地址栏 直接输入https://git@github.com/nhn/raphael.git 也会重定向到https://github.com/nhn/raphael.git,因此,猜测,上面两个写法,都行

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容