英文:
Invalid version control suffix in bitbucket.org/ path when importing private repo in golang
问题
我采取的步骤如下:
1- 配置 .gitconfig 文件
insteadOf = https://bitbucket.org/
2- 导出 GOPRIVATE=bitbucket.org/myproject/helpers-go
3- 运行 go get 命令
我的 go.mod 文件如下:
module bitbucket.org/myproject/x/test-service
go 1.16
require (
bitbucket.org/myproject/helpers-go v0.0.2
)
replace bitbucket.org/myproject/helpers-go => bitbucket.org/myproject/helpers-go.git v0.0.2
- 我的 SSH 密钥有效,我可以推送/拉取每个服务。
- 我在最后一个 helpers-go 提交中也有 v0.0.2 的标签。
我正在尝试将私有仓库(helpers-go)导入到(test-service)中,但我遇到的错误是:
go: bitbucket.org/myproject/helpers-go@v0.0.2: invalid version control suffix in bitbucket.org/ path
即使我将 v0.0.2 更改为类似于 v0.0.9 的随机值,而我没有这样的标签,我仍然会收到相同的错误。
感谢您的帮助...
英文:
The steps I took:
1- Configure .gitconfig
insteadOf = https://bitbucket.org/
2- export GOPRIVATE=bitbucket.org/myproject/helpers-go
3- go get
my go.mod file ->
module bitbucket.org/myproject/x/test-service
go 1.16
require (
bitbucket.org/myproject/helpers-go v0.0.2
)
replace bitbucket.org/myproject/helpers-go => bitbucket.org/myproject/helpers-go.git v0.0.2
- My ssh key works. I can push/pull each services.
- I also have the v0.0.2 tag on my last helpers-go commit.
I am trying to import private repo(helpers-go) into (test-service) and the error I get is :
go: bitbucket.org/myproject/helpers-go@v0.0.2: invalid version control suffix in bitbucket.org/ path
Even if I change the v0.0.2 to something random like v0.0.9 which I don`t have a tag like this, I still get the same error.
Appreciate the help...
答案1
得分: 1
已解决:
1- 我使用的是 go 1.16,这个版本不支持 bitbucket 的私有仓库。我认为它在 gitlab 上没有同样的问题。将其升级到 go 1.19。
2- 这里有一个小改动 .org/ -> .org:
insteadOf = https://bitbucket.org/
3- 还要确保我导入的私有仓库有一个以 .go 结尾的文件。我的 .go 文件都在其他文件夹中,导致主文件夹没有 .go 文件。
英文:
it is solved:
1- I was using go 1.16 and there was an issue with bitbucket private repos not being supported for this version. I don`t think it has the same issue with gitlab. Upgrading it to go 1.19
2- Small change here .org/ -> .org:
insteadOf = https://bitbucket.org/
3- Also making sure the private repo I am importing has a file that ends with .go. My .go files were all in other folders leaving main folder without a .go file.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论