Search code examples
gitgogithubgithub-enterprise

"go get" fails to download a go package, git repository hosted on a Github Entreprise (behind VPN)


I'm trying to download a Go package that is on an Entreprise Github.

Noteworthy, the domain is not visible outside the VPN, however I'm connected to that VPN.

I can browse to https://github.mydomain.com/some_repository with a browser, however I need to login.

$ go get -v github.mydomain.com/some_repository

get "github.mydomain.com/some_repository": found meta tag get.metaImport{Prefix:"github.mydomain.com/some_repository", VCS:"git", RepoRoot:"https://github.mydomain.com/some_repository.git"} at //github.mydomain.com/some_repository?go-get=1
go: downloading github.mydomain.com/some_repository v0.0.0
go get github.mydomain.com/some_repository: github.mydomain.com/[email protected]: verifying module: github.mydomain.com/[email protected]: reading https://sum.golang.org/lookup/github.mydomain.com/[email protected]: 410 Gone
        server response: not found: github.mydomain.com/[email protected]: unrecognized import path "github.mydomain.com/some_repository": https fetch: Get "https://github.mydomain.com/some_repository?go-get=1": dial tcp: lookup github.mydomain.com on 8.8.8.8:53: no such host

I initially thought this was due to the command line tools not having the access token, since the browser can access but not go get. I've generated a token on the Entreprise Github, and tried to resolve this problem via:

git config --local http.extraheader "PRIVATE-TOKEN: <token>"
git config --local url."[email protected]:".insteadOf "https://github.mydomain.com/"

as explained here but that did not help.

The presence of lookup github.mydomain.com on 8.8.8.8:53: no such host could be a clue, since 8.8.8.8 is google's DNS and that can't possibly work since mydomain.com only exists on the VPN. If one disconnects from VPN that mydomain.com does not exist. I'm not sure why go get would use 8.8.8.8 as a DNS though.

scutil --dns | grep 'nameserver\[[0-9]*\]' lists several DNS servers, none of which is 8.8.8.8, so perhaps go get hardcodes it?


Solution

  • It appears setting environment variable GOPRIVATE=*.mydomain.com resolves this problem.