无法通过HTTP代理获取存储库。

huangapple go评论65阅读模式
英文:

Unable `go get` a repository via an HTTP proxy

问题

当我尝试安装Burrow时,遇到了以下错误:

package gopkg.in/gcfg.v1: unrecognized import path "gopkg.in/gcfg.v1" 
(https fetch: Get https://gopkg.in/gcfg.v1?go-get=1: proxyconnect tcp: dial tcp :0: getsockopt: connection refused)

我已经通过以下方式设置了代理:

export http_proxy=myproxy:port
export https_proxy=myproxy:port

编辑:

执行以下命令:

go get -u gopkg.in/gcfg.v1

同样出现了相同的错误:

package gopkg.in/gcfg.v1: unrecognized import path "gopkg.in/gcfg.v1" 
(https fetch: Get https://gopkg.in/gcfg.v1?go-get=1: proxyconnect tcp: dial tcp :0: getsockopt: connection refused)

编辑1:

执行以下命令:

go get -v gopkg.in/gcfg.v1

出现了以下错误信息:

Fetching https://gopkg.in/gcfg.v1?go-get=1
https fetch failed: Get https://gopkg.in/gcfg.v1?go-get=1: proxyconnect tcp: dial tcp :0: getsockopt: connection refused
package gopkg.in/gcfg.v1: unrecognized import path "gopkg.in/gcfg.v1" (https fetch: Get https://gopkg.in/gcfg.v1?go-get=1: proxyconnect tcp: dial tcp :0: getsockopt: connection refused)

以上是要翻译的内容。

英文:

When I am trying to install Burrow https://github.com/linkedin/Burrow#build-and-install

go get github.com/linkedin/Burrow

I am getting the following error :

package gopkg.in/gcfg.v1: unrecognized import path "gopkg.in/gcfg.v1" 
(https fetch: Get https://gopkg.in/gcfg.v1?go-get=1: proxyconnect tcp: dial tcp :0: getsockopt: connection refused)

I have already set up proxy by:

export http_proxy=myproxy:port
export https_proxy=myproxy:port

Edit:

go get -u gopkg.in/gcfg.v1

also gives the same error:

package gopkg.in/gcfg.v1: unrecognized import path "gopkg.in/gcfg.v1" 
(https fetch: Get https://gopkg.in/gcfg.v1?go-get=1: proxyconnect tcp: dial tcp :0: getsockopt: connection refused)

Edit1:

go get -v gopkg.in/gcfg.v1

Fetching https://gopkg.in/gcfg.v1?go-get=1
https fetch failed: Get https://gopkg.in/gcfg.v1?go-get=1: proxyconnect tcp: dial tcp :0: getsockopt: connection refused
package gopkg.in/gcfg.v1: unrecognized import path "gopkg.in/gcfg.v1" (https fetch: Get https://gopkg.in/gcfg.v1?go-get=1: proxyconnect tcp: dial tcp :0: getsockopt: connection refused)

答案1

得分: 3

我也遇到了同样的错误。原来是我的https代理设置不正确。请确保http和https代理都指向以http开头的同一个代理。

export http_proxy=<http://proxy:port>
export https_proxy=<http://proxy:port>
英文:

I was also getting the same error. Turns out that my https proxy was incorrect. Make sure both http and https proxy are pointing to same proxy starting with http.

export http_proxy=&lt;http://proxy:port&gt;
export https_proxy=&lt;http://proxy:port&gt;

答案2

得分: 1

从您的计算机中删除环境变量HTTPS_PROXY的步骤如下:

  1. 打开系统属性 - 环境变量 - 当前用户变量/系统变量:找到并删除HTTPS_PROXY

  2. 重新启动终端以使环境变量修改生效。

英文:

Remove env HTTPS_PROXY from your PC:

  1. SystemProperty - Environment - current user variable/system variable : find and remove HTTPS_PROXY.

  2. Restart your terminal to enable env modification to take effect.

答案3

得分: -1

我使用以下方法解决了这个问题:

export https_proxy=$http_proxy

为了找到一个更持久的解决方案,可以更新 /etc/environment 文件。

英文:

I solved the problem using:

export https_proxy=$http_proxy

To a more long lasting solution the /etc/environment can be updated.

huangapple
  • 本文由 发表于 2017年2月17日 18:14:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/42295200.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定