秋栈博客

七月

MacOS下更新oh-my-zsh报错:fatal: unable to connect to github.com

2022-07-27

什么是oh-my-zsh

相比于默认的 Bash,Zsh 有更多的自定义选项,并支持扩展。因此 Zsh 可以实现更强大的命令补全,命令高亮等一系列酷炫功能。

问题

➜  .oh-my-zsh git:(master) upgrade_oh_my_zsh
Note: `upgrade_oh_my_zsh` is deprecated. Use `omz update` instead.
Updating Oh My Zsh
fatal: unable to connect to github.com:
github.com[0: 20.205.243.166]: errno=operation timed out

There was an error updating. Try again later?

分析

报错给了指定的IP信息,那么我当时安装的时候应该是在hosts文件里面指定了更新所连接的官方IP地址
➜  ~ cat /etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1	localhost
255.255.255.255	broadcasthost
::1             localhost
185.199.108.133 raw.githubservercontent.com
这个默认是http协议,更新时候连接服务器应该是只能用https协议去拉取更新包 执行替换命令再次更新
➜  .oh-my-zsh git:(master) git config --global url."https://".insteadOf git://
➜  .oh-my-zsh git:(master) upgrade_oh_my_zsh

解决

  • 0