微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

homebrew 安装问题fatal: unable to access ‘https://github.com/Homebrew/brew/‘: Failed to connect to githu

Mac安装homebrew时报错

安装命令

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

报错:

fatal: unable to access 'https://github.com/Homebrew/brew/': Failed to connect to github.com port 443: Operation timed out

Failed during: git fetch --force origin

如何解决呢?

1、修改DNS配置

添加8.8.8.8,然后保存

2、执行以下命令

// 执行下面这句命令,更换为中科院的镜像:
git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1

// 把homebrew-core的镜像地址也设为中科院的国内镜像

cd "$(brew --repo)"

git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"

git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

// 更新
brew update

 

=========执行brew update 时报如下错

Error:

  homebrew-core is a shallow clone.

To `brew update`, first run:

  git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow

This command may take a few minutes to run due to the large size of the repository.

This restriction has been made on GitHub's request because updating shallow

clones is an extremely expensive operation due to the tree layout and traffic of

Homebrew/homebrew-core and Homebrew/homebrew-cask. We don't do this for you

automatically to avoid repeatedly performing an expensive unshallow operation in

CI systems (which should instead be fixed to not use shallow clones). Sorry for

the inconvenience!

3、执行以下命令 解决步骤2的报错

git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow

 

4、执行brew update

done

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐