Mac M1 Montery12.4访问GitHub提示错误的解决

问题:下载时候提示curl: (7) Failed to connect to github.com port 443 after 6 ms: Connection refused,这是因为我是通过代理服务器访问网络的

lixiaohui@mac ~:brew install --cask countdown
==> Downloading https://github.com/soffes/Countdown/releases/download/v0.1.0/Cou
curl: (7) Failed to connect to github.com port 443 after 6 ms: Connection refused

解决方法:
1、设置git的代理

git config --global http.proxy http://127.0.0.1:8080
git config --global https.proxy https://127.0.0.1:8080

http://127.0.0.1:8080是我本地的代理服务器和服务器端口
2、设置mac系统的代理,打开本地的~/.zprofile文件,添加用户级环境变量

vim ~/.zprofile
# 粘贴下面两行到文件中
export HTTPS_PROXY=http://127.0.0.1:8080
export HTTP_PROXY=http://127.0.0.1:8080
# 保存后退出
# 执行使其生效
source ~/.zprofile

即可解决,如下

lixiaohui@mac ~:brew install --cask countdown           
==> Downloading https://github.com/soffes/Countdown/releases/download/v0.1.0/Cou
==> Downloading from https://objects.githubusercontent.com/github-production-rel
######################################################################## 100.0%
==> Installing Cask countdown
==> Moving Screen Saver 'Countdown.saver' to '/Users/lixiaohui/Library/Screen Sa
🍺  countdown was successfully installed!
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容