[英]go get PRIVATE repo with proxy
我公司提供了VPN,但是只有全局代理,所以我在docker开了一个vpn,对外提供sock5代理,我想让go get ≈ <private_repo_path>
使用我本地启动的sock5代理。
- Go env
```
GOPRIVATE="<company_gitlab_url>"
GOPROXY="http://goproxy.cn,direct" (I'm in China. This is CN Golang Proxy)
```
- Git
```
[http "https://<company_gitlab_url>"]
proxy = socks5://127.0.0.1:1080
[url "ssh://git@<company_gitlab_url>"]
insteadOf = http://<company_gitlab_url>/
[url "git@<company_gitlab_url>:"]
insteadOf = http://<company_gitlab_url>/
```
- netrc
```
machine <company_gitlab_url>
login username
password accessToken
```
我期待git clone <company_gitlab>/<repo_name>
命令使用 sock5 代理,所以我已经为 ZBA9F11ECC3497D9993B933FDC2BD6E 配置了 http 代理,它可以工作
[http "https://<company_gitlab_url>"]
proxy = socks5://127.0.0.1:1080
但是go get <company_gitlab>/<repo_name>
不起作用(不使用 sock5 代理)
Knowing that go get
is essentially git clone
and that I have ssh insteadOf http
set up, I thought I should configure an SSH proxy:
所以我在.ssh/config中添加了如下配置
Host <company_gitlab_url>
ProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %p
但它不起作用
go get <company_gitlab_url>/<repo_name>
显示
go get: unrecognized import path "<company_gitlab_url>/golang/base": https fetch: Get "https://<company_gitlab_url>/golang/base?go-get=1": dial tcp 10.130.xxx.xxx:443: i/o 超时
我认为10.130.xxx.xxx是我公司Gitlab.net的内部IP,怎么办?
我修复它, go get xx
不仅使用 ssh,而且有一次 http 获取。
所以使用https_proxy(http_proxy)=sock5://xxx go get xxx
命令
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.