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!

你可能感兴趣的:(Mac M1 Montery12.4访问GitHub提示错误的解决)