How to Use a Private Git Repository as a Go Module

Set the GOPRIVATE environment variable to your repository domain to bypass the public proxy and fetch private Go modules directly from Git.

Tell the Go toolchain to skip proxy checks for your private repository by setting the GOPRIVATE environment variable to the repository's domain pattern.

export GOPRIVATE="github.com/your-org/*"
go get github.com/your-org/private-repo

This ensures the go command fetches the module directly from Git instead of failing when the public proxy cannot access it.