Invalid version control suffix in bitbucket.org/ path when importing private repo in golang

huangapple go评论68阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2022年9月23日 02:02:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/73818976.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定