add-apt-repository 无法在代理上运行

add-apt-repository 无法在代理上运行

可能重复:
如何从代理后面添加存储库?

我想通过代理(使用用户名/密码)连接的 Ubuntu 11.10 笔记本电脑上的 gnome-terminal 发送 add-apt-repository 命令。按照这个答案,我编辑了我的 apt.conf 文件:
如何在通过代理连接的系统上使用 apt-get 安装软件包?

/etc/apt/apt.conf

Acquire::http::proxy "http://<username>:<password>@<proxy>:<port>/";
Acquire::ftp::proxy "ftp://<username>:<password>@<proxy>:<port>/";
Acquire::https::proxy "https://<username>:<password>@<proxy>:<port>/";

我现在可以apt-get install package-name毫无问题地运行,但是当我尝试时add-apt-repository,它不起作用。有什么建议吗?

sudo add-apt-repository ppa:bumblebee/stable

Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 88, in <module>
    ppa_info = get_ppa_info_from_lp(user, ppa_name)
  File "/usr/lib/python2.7/dist-packages/softwareproperties/ppa.py", line 65, in get_ppa_info_from_lp
    lp_page = urlopen(req).read()
  File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 394, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 412, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 372, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1209, in https_open
    return self.do_open(httplib.HTTPSConnection, req)
  File "/usr/lib/python2.7/urllib2.py", line 1171, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno 8] _ssl.c:503: EOF occurred in violation of protocol>

答案1

这是一个已知错误

据一位订阅者称,你可以按照以下步骤解决此问题:

sudo visudo

然后添加以下几行

Defaults env_keep="http_proxy"
Defaults env_keep="https_proxy"

然后:

sudo bash
export https_proxy=http://[username:password@]www.proxy.com:8000/
add-apt-repository ppa:<whatever>

答案2

您可以按照此处的建议尝试,因为有人已经解决了这个问题:

如何从代理后面添加存储库?

相关内容