MacOS:brew 安装包在终端中引发代理问题

问题描述 投票:0回答:3

我正在绞尽脑汁试图找出从哪里读取代理。

这是背景。我正在尝试在 Mac 终端上执行

brew install wget

但是,我立刻就明白了

fatal: unable to access 'https://github.com/Homebrew/brew/': Failed to connect to xxxxproxy.proxy.proxy.com port 8080: Connection refused

我尝试删除 HTTP_PROXY、HTTPS_PROXY、ALL_PROXY、http_proxy、https_proxy、all_proxy。当我对上述所有变量运行

echo $xxxxx_proxy
时,我得到空白值,表明代理未设置。

这个代理是从哪里读取的?任何帮助/指导将不胜感激。谢谢!

编辑:我可能发布了一个非常愚蠢的问题,或者这个问题可能是重复的(我在这里找不到)。如果是这样,我提前道歉:)

macos terminal proxy wget
3个回答
1
投票

我家中的

.gitconfig
文件
/Users/<username>/.gitconfig
似乎在其中设置了代理值。当我评论这些时,一切都开始顺利进行。

 #[http]
 #   proxy = xxx.xxx.xxx.com:80
 #[https]
 #   proxy = xx.xxx.xxx.com:80

0
投票

要在代理后面使用

brew
包,您应该设置变量
ALL_PROXY

export ALL_PROXY=proxyIP:port

如果您想删除代理定义并使用直接连接,请在终端中执行:

unset ALL_PROXY

并在同一终端中执行命令


0
投票

我遇到了同样的问题,但没有在 stackoverflow 、brew 文档或其他任何地方找到答案。 我的组织更改了他们的公司代理,但brew仍在查看旧代理,尽管设置了大小写

HTTP_PROXY
HTTPS_PROXY
ALL_PROXY
,但我得到了与OP相同的错误

事实证明,brew 运行了一些 git 命令,而我的旧代理是在 git config 中设置的

http.proxy

很可能你的代理值也正在从 git 中读取

http.proxy

更新 git 配置后,一切都开始像以前一样工作

git config --global http.proxy http://proxyUsername:[email protected]:port
git config --global https.proxy https://proxyUsername:[email protected]:port

或者,取消设置代理配置

git config --global --unset http.proxy
git config --global --unset https.proxy
© www.soinside.com 2019 - 2024. All rights reserved.