windows 如何为 apt-cyg 设置代理?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7851986/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 18:19:25  来源:igfitidea点击:

How to set a proxy for apt-cyg?

windowslinuxproxycygwin

提问by Tareq Ibrahim

How to set a proxy for apt-cyg, http and socks? i tried using

如何为apt-cyg、http和socks设置代理?我试过使用

export http_proxy= 

but it did not work.

但它没有用。

回答by Romain

This should work :

这应该工作:

export ftp_proxy=http://[user]:[passwd]@[proxy.foo.com]:[portnumber]

回答by TrYde

You can also add it all in one line (it works well with cygwin/apt-get embedded in mobaxterm - add it to .bashrc):

您也可以在一行中添加所有内容(它适用于嵌入在 mobaxterm 中的 cygwin/apt-get - 将其添加到 .bashrc):

export {ftp,http,https}_proxy=http://[user]:[passwd]@[proxy.foo.com]:[port]

回答by vinaykola

I'm not sure about Cygwin, but these are the lines from my ~/.bashrc

我不确定 Cygwin,但这些是我的 ~/.bashrc 中的行

export http_proxy=http://[user]:[passwd]@[proxy.foo.com]:[portnumber]
export https_proxy=http://[user]:[passwd]@[proxy.foo.com]:[portnumber]
export HTTP_PROXY=http://[user]:[passwd]@[proxy.foo.com]:[portnumber]
export HTTPS_PROXY=http://[user]:[passwd]@[proxy.foo.com]:[portnumber]

If cygwin is similar to bash, it should work.

如果 cygwin 类似于 bash,它应该可以工作。

回答by Brian Beckett

I made it work by setting two Windows environment variables: http_proxy and http_proxy. I previously had HTTP_PROXY, but that wasn't picked up.

我通过设置两个 Windows 环境变量使其工作:http_proxy 和 http_proxy。我以前有 HTTP_PROXY,但没有被接受。

Note that as Cygwin is a Windows process, after setting the new environment variables you need to launch a new Cygwin process to pick up the change.

请注意,由于 Cygwin 是一个 Windows 进程,因此在设置新的环境变量后,您需要启动一个新的 Cygwin 进程来接受更改。

回答by Marc Brazeau

Old question, but none of the answers seem right.

老问题,但似乎没有一个答案是正确的。

From what I can tell trying to UNSET a proxy to run this on one of my boxes, I was getting this error: wget: unable to resolve host address ‘webproxystatic-mywork.com'

据我所知,尝试取消设置代理以在我的一个机器上运行它,我收到此错误:wget:无法解析主机地址“webproxystatic-mywork.com”

Looks like apt-cyg uses wget. So this brings you to this question: setting proxy in wget

看起来 apt-cyg 使用 wget。所以这给你带来了这个问题:在 wget 中设置代理

The answer of which is: set (or in my case unset) http_proxy/https_proxyin /etc/wgetrc:

其答案是: set (或在我的情况下未设置)http_proxy/ https_proxyin /etc/wgetrc

# You can set the default proxies for Wget to use for http, https, and ftp.
# They will override the value in the environment.
#https_proxy = http://proxy.yoyodyne.com:18023/
#http_proxy = http://proxy.yoyodyne.com:18023/
#ftp_proxy = http://proxy.yoyodyne.com:18023/

# If you do not want to use proxy at all, set this to off.
#use_proxy = on