Search code examples
gonexusgo-getgit-credential-managergo-git

git credential.helper instead of .netrc to get go dependencies


To cashing dependencies I use (as ) which connect to goproxy servers (because nexus can't get dependencies directly from GitHub) outside of private network.


nexus.some.repo.com:4443/repository/go-nexus-proxy ➡️ gonexus.dev nexus.some.repo.com:4443/repository/go-proxy ➡️ proxy.golang.org ...


GOPROXY="nexus.some.repo.com:4443/repository/go-proxy,nexus.some.repo.com:4443/repository/go-nexus-proxy"

enter image description here

and I use .netrc file to connect to

machine nexus.some.repo.com:4443 
login SOME_LOGIN 
password SOME_PASS 
protocol https

Could I use git credential.helper instead of .netrc

If yes 👉🏻 How can I config git credential.helper


Solution

  • If you are already using netrc, you could simply configure the credential helper to use netrc

    You can download and put in your PATH git-credential-netrc.perl

    And then:

    git config --global credential.helper netrc