Mos*_*afa 91
围棋程序理解环境变量http_proxy和no_proxy,而是因为这还不够,go get使用源代码控制管理器检索代码.因此,您还必须为SCM设置HTTP代理设置.使用此为水银和这个 GIT中.
http_proxy价值可以像http://user:password@host:port/.用户,密码和端口部分是可选的.no_proxy是以逗号分隔的服务器列表,不应通过代理连接.它的价值可以是foo.com,bar.net:4000.
您可以在自己的环境中设置这些环境变量bash_profile,但是如果要限制它们的使用go,可以像这样运行:
$ http_proxy=127.0.0.1:8080 go get code.google.com/p/go.crypto/bcrypt
Run Code Online (Sandbox Code Playgroud)
如果这是您一直想要的,请设置此别名以避免每次都键入代理部分:
$ alias go='http_proxy=127.0.0.1:8080 go'
Run Code Online (Sandbox Code Playgroud)
从现在开始,您可以go正常使用,但它使用您的HTTP代理.
这对我有用:
alias go='http_proxy=http://127.0.0.1:1081/ https_proxy=http://127.0.0.1:1081/ no_proxy=localhost,127.0.0.0/8,::1 go'
Run Code Online (Sandbox Code Playgroud)
注意:对于某些人来说,协议可能会有所不同https_proxy=http://127.0.0.1:1081
您还可以使用https://github.com/cyfdecyf/cow/将http请求映射到socks5流量
如果您被 GFW 阻止,非常方便
在 Windows 命令行上:
set http_proxy=http://[user]:[pass]@[proxy_ip]:[proxy_port]/
set https_proxy=http://[user]:[pass]@[proxy_ip]:[proxy_port]/
...然后导航到https://github.com/并下载 GitHub 证书(我将名称设置为goland_cert.cer)
...现在执行 OpenSSL 命令将其导出为 PEM 格式
openssl x509 -inform der -in goland_cert.cer -out goland_cert.pem
...最后在 git global config 中设置证书
git config --global http.sslCAInfo C:/Users/[User]/certs/golang_cert.pem
| 归档时间: |
|
| 查看次数: |
69914 次 |
| 最近记录: |