4

My company provides a VPN, but only a global proxy, so I started a vpn in docker and provided the sock5 proxy to the outside, and I wanted go get ≈ <private_repo_path> use my locally started sock5 proxy.

my configuration file

- 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
```

I'm expecting the git clone <company_gitlab>/<repo_name> command use the sock5 proxy,so I've configured the http proxy for git, it works

[http "https://<company_gitlab_url>"]
        proxy = socks5://127.0.0.1:1080

But go get <company_gitlab>/<repo_name> not work (not use the sock5 proxy)

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:

So I added the following configuration to .ssh/config

Host <company_gitlab_url>
    ProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %p

But it doesn't work

go get <company_gitlab_url>/<repo_name> shows

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 timeout

I think 10.130.xxx.xxx is the internal IP of my company Gitlab.net, what should I do?

Mashiro
  • 86
  • 5

1 Answers1

3

I fix it,go get xx not only use ssh,and has once http fetch。

so use https_proxy(http_proxy)=sock5://xxx go get xxx command

Mashiro
  • 86
  • 5