Make Go mod and Git to use specify .netrc
Background
I want to make a private goproxy, direct lookup with gitlab.
This service should be stateless, use user’s gitlab token. It works with
1 |
|
Hot to do
Go document said that to use authenticate over HTTPS, we can use .netrc file.
But, by default, Git will only use $HOME/.netrc (supported by CURL).
Go vcs (cmd/go/internal/vcs) will follow NETRC env, but is not enough. We need make Git to use NETRC too.
Git contrib provider git-credential-netrc.
We can configure Git to use it.
1 |
|
Then, Go mod and Git and both works with NETRC env
Make Go mod and Git to use specify .netrc
https://hunsh.net/20240505/Make-go-mod-and-git-to-use-specify-netrc/