Go private module 410/auth failure (GOPRIVATE) - Fix in CI
Public proxies and the sum DB cannot fetch or verify private modules. Without GOPRIVATE and git credentials, Go tries the public path and gets a 410 or an auth error.
What this error means
A build fails fetching github.com/yourorg/private-lib with a 410 Gone from the proxy or terminal prompts disabled/could not read Username. It means CI tried the public proxy or could not authenticate to the private repo.
go
go: github.com/yourorg/private-lib@v0.3.0: reading https://proxy.golang.org/.../v0.3.0.info: 410 Gone
fatal: could not read Username for 'https://github.com': terminal prompts disabledCommon causes
GOPRIVATE not set
Without GOPRIVATE the private path goes through the public proxy and sum DB, which return 410 because they cannot see it.
No git credentials in CI
The runner has no token configured for the private host, so the direct git fetch cannot authenticate.
How to fix it
Set GOPRIVATE and skip the proxy
- List your private module prefixes in GOPRIVATE so Go bypasses the proxy and sum DB.
.github/workflows/ci.yml
export GOPRIVATE=github.com/yourorg/*
export GONOSUMDB=github.com/yourorg/*Inject git credentials
- Rewrite the host to use a token so the direct fetch authenticates.
.github/workflows/ci.yml
git config --global url."https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/".insteadOf "https://github.com/"How to prevent it
- Set
GOPRIVATEfor every private module prefix in CI. - Provide a least-privilege token for private fetches.
- Avoid routing private modules through the public proxy.
Related guides
Go "410 Gone" fetching module from proxy - Fix in CIFix Go "410 Gone" fetching a module from the proxy in CI - a missing version or a transient proxy hiccup. Pin…
Go "verifying module: checksum mismatch" - Fix in CIFix Go "verifying module: checksum mismatch" in CI - go.sum disagrees with the downloaded module. Resolve a r…
Go module download i/o timeout from proxy - Fix in CIFix Go module download "i/o timeout" / connection reset from the proxy in CI - a transient network failure. A…