I'm on a Apple MAC Laptop, go get command is not working.
I have normal git access, I can git clone and git commit and git push. Why does this go get command not work?
temp % go get github.com/MYCOMPANY/myproject
go get: module github.com/MYCOMPANY/myproject: git ls-remote -q origin in /Users/someuser/go/pkg/mod/cache/vcs/1872293eea4df8de643499713e2d8621a72624bb2514a7a88c1182d1869ef891: exit status 128:
ssh: Could not resolve hostname github.com:MYCOMPANY: nodename nor servname provided, or not known
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
temp % go get github.com/MYCOMPANY/myproject
go get: module github.com/MYCOMPANY/myproject: git ls-remote -q origin in /Users/someuser/go/pkg/mod/cache/vcs/1872293eea4df8de643499713e2d8621a72624bb2514a7a88c1182d1869ef891: exit status 128:
ssh: Could not resolve hostname github.com:MYCOMPANY: nodename nor servname provided, or not known
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
CodePudding user response:
This is what works for me, based on @elulcao
go env -w GOPRIVATE=github.com/COMPANYNAME
git config --global --add url."[email protected]:".insteadOf "https://github.com/"
Then I can do
go mod download
In the projects git folder or go get
CodePudding user response:
'go get' by default does not support private repositories. It only supports public repos.
If you want to get private repos please refer to this link
