Konubinix' opinionated web of thoughts

How to Use a Gitlab Private Repository as a Go Module?

Fleeting

how to use a gitlab private repository as a go module?

It looks like go will first try a few http calls before using git.

Create the following in your netrc file

# see https://gitlab.com/gitlab-org/gitlab-foss/-/issues/65681
machine gitlab.com
  login yougitlabid (without the @)
  password someapitoken (with rights at least to read_api, read_repository and write_repository)

Disable the checksum checking indicating it is a private repository with

export GOPRIVATE=gitlab.com/youprivateprefix/*