[转]fatal: remote error: The unauthenticated git protocol on port 9418 is no longer support问题解决

背景

因为居家办公,把代码从远程clone下来之后,发现使用npm install一直失败。

提示的错误:fatal: remote error: The unauthenticated git protocol on port 9418 is no longer support

刚开始以为是因为node版本的问题,以前因为版本的问题,把自己折腾的欲仙欲死。node --version之后,发现版本OK。

如果不是版本的问题,那么是什么问题导致的呢?

仔细查看log,发现有个github的链接,点击进去,上面提示因为github的安全机制升级导致的问题。

然后官方给出的对应的解决方案:

解决不再支持端口 9418 上未经身份验证的 git 协议错误。

第一种解决方案是使用 https://github.com 而不是 git://github.com ,问题就可以解决。

第二种解决方案是在项目的 package.json 文件中找到url中的 git:// 并将其替换为 github: 即 git://github.com/…… 替换为 github:。

解决方案

方案一 使用https:替换git:

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

方案二 修改git://github.com/

在 package.json 文件中找到 git://  url 并将其替换为 github: 

就像这样:

git://github.com/... 

替换成:

github:......

 参考链接:

1、fatal: remote error: The unauthenticated git protocol on port 9418 is no longer support问题解决

2、The unauthenticated git protocol on port 9418 is no longer supported.

posted @ 2022-04-18 22:58  rainbow70626  阅读(198)  评论(0编辑  收藏  举报