cmd/go: go get fails with private bitbucket repositories #27344
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
changed the title
go get fails with private bitbucket repositories (modules enabled)
Aug 30, 2018
I had Similar issues in more than one laptop with Ubunto, MacOs and windows, and instead of blind troubleshooting (or reinstall git that sometimes helped mainly on windows), I resolved/worked around with these (temp/troubleshooting) changes/steps :
In other words - this will not SOLVE your problem but has a good success rate of showing where the issue is.
and last ... return your original bin/go :)
Reason and suggested resolution:
When go get command tries to pull a bitbucket repo, it first tries to get the repo details as a public repo, resolving in the "403 Forbidden" reply.
Then it tries to check if a private repo is git or hg (as per issue #5375) , first using git, that will also resolve in 403 - if global git config does not include user.name , user.email.
vcs.go main problem is not reporting right statuses that will aid the user to resolve the configuration by himself.
git config --global user.name "your-bitbucket-user"
If no comments, I can probably set some of the above logic coded in place (vcs.go).
For (1), we shouldn't print anything that looks like an error until we're sure it's actually an error. If we get all the way through the chain of attempts and it's still failing, then we should display a helpful message.
For (2), that seems too specific (to git and to BitBucket). Perhaps a URL (such as https://golang.org/doc/faq#git_https or a Wiki page) would be more helpful? That could collect configuration steps for various providers and tools without baking it into the
For (3), we should probably pass through the explicit error from the tool. (That's #25982.)