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,因此,猜測,上面兩個寫法,都行

?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容