首页 > 解决方案 > 去获取私有 bitbucket repo,禁止 403

问题描述

在执行时 go get bitbucket.org/../..

我收到这个错误

yash.jain projectname % go get bitbucket.org/../..
go: bitbucket.org/../..
https://api.bitbucket.org/2.0/repositories/../..?fields=scm: 403 Forbidden
go: error loading module requirements

我试过的

不过,我得到了同样的错误。如果我做错了什么,请告诉我。

标签: gogo-get

解决方案


这些是我试图使其工作的步骤。

  1. 设置 SSH 密钥并连接到 bitbucket。我通过 bitbucket 使用 sourcetree gui 来连接使用ssh.
  2. 设置GOPRIVATE=bitbucket.org/<orgname>/*

*是允许组织的所有回购。

在这两个步骤之后,我可以导入包。

注意:Sourcetree 仅适用于 Mac 和 Windows。

使用命令行:对于 Linux/Mac/Windows:

  1. git config --global url."git@bitbucket.org:".insteadOf "https://bitbucket.org/"
  2. 设置GOPRIVATE=bitbucket.org/<orgname>/*

推荐阅读