MacOS Oh-My-Zsh 更新失败

6,024 阅读1分钟

1. 问题

在使用 iTerm 自动更新 Oh-My-Zsh 失败,错误提示如下:

fatal: remote error:

The unauthenticated git protocol on port 9418 is no longer supported. Please see github.blog/2021-09-01-… for more information.

我的设备是:MacBook Pro, 系统版本:Monterey 12.2.1。

2. 解决方案

直接在终端执行一下命令:

  • cd $ZSH:进入 ZSH 的目录。
  • git remote set-url origin "https://github.com/ohmyzsh/ohmyzsh.git":修改远程仓库的地址。

原仓库地址:git://github.com/ohmyzsh/ohmyzsh.git

更改后的仓库地址:https://github.com/ohmyzsh/ohmyzsh.git

只需要将原有的 git 协议的仓库地址修改为 https 的即可。

更新完仓库地址以后,执行 omz update 即可更新成功。

3. 问题原因

GitHub 官方为了提高 git 协议的安全性,所以从 2022-03-15 以后将不在支持未加密的 git 协议(unencrypted Git protocol)。所以如果你还是使用老的 git 协议去更新 Oh-My-Zsh 就会出现这个错误,这个时候只需要将仓库地址更新为 https 协议即可。

详情可以参考这篇文章:GitHub Blog about Git protocol security

4. 参考文章:

Github Issue