Avatar ·

How to properly configure `go get` for working with a private Git repository?

Hi! I've been writing Go for a couple of months and ran into a problem that I can't solve for the third day. Our project has several internal libraries that are stored in private repositories on a corporate GitLab. When I try to run `go get ourcompany.com/scm/team/lib/internal-utils`, I get an error: ``` go: ourcompany.com/scm/team/lib/internal-utils@v1.0.0: unrecognized import path "ourcompany.com/scm/team/lib/internal-utils": https fetch: Get "https://ourcompany.com/scm/team/lib/internal-utils?go-get=1": dial tcp: lookup ourcompany.com: no such host ``` I tried adding to `.gitconfig`: ``` [url "git@ourcompany.com:"] insteadOf = https://ourcompany.com/ ``` But that didn't help. I've also heard about `GOPRIVATE`, `GOFLAGS`, and `go env -w`, but I don't understand how to