Watch 754 Star 1.2K Fork 338

开源中国 / Gitee FeedbackRuby

设置GOPRIVATE后go get 无法正常导入gitee中的go包

缺陷
待办的
yindaheng98  Opened this issue

问题描述

设置GOPRIVATE后go get 无法正常导入 gitee 中的go包

重现步骤

$ go env -w GOPRIVATE="gitee.com/WuXiSTC"
$ go get -v gitee.com/WuXiSTC/gogettest
$ go env -w GOPRIVATE="gitee.com/yindaheng98"
$ go get -v gitee.com/yindaheng98/gogettest

期望效果

$ go env -w GOPRIVATE="gitee.com/WuXiSTC"
$ go get -v gitee.com/WuXiSTC/gogettest
go: finding gitee.com/WuXiSTC/gogettest latest
go: downloading gitee.com/WuXiSTC/gogettest v0.0.0-20200317055944-0a018ce2c5d3
go: extracting gitee.com/WuXiSTC/gogettest v0.0.0-20200317055944-0a018ce2c5d3
gitee.com/WuXiSTC/gogettest
$ go env -w GOPRIVATE="gitee.com/yindaheng98"
$ go get -v gitee.com/yindaheng98/gogettest
go: finding gitee.com/yindaheng98/gogettest latest
go: downloading gitee.com/yindaheng98/gogettest v0.0.0-20200317060205-e8e593151786
go: extracting gitee.com/yindaheng98/gogettest v0.0.0-20200317060205-e8e593151786
gitee.com/yindaheng98/gogettest

实际效果

$ go env -w GOPRIVATE="gitee.com/WuXiSTC"
$ go get -v gitee.com/WuXiSTC/gogettest
get "gitee.com/WuXiSTC/gogettest": found meta tag get.metaImport{Prefix:"gitee.com/WuXiSTC/gogettest", VCS:"git", RepoRoot:"https://gitee.com/WuXiSTC/gogettest.git"} at //gitee.com/WuXiSTC/gogettest?go-get=1
go: finding gitee.com/WuXiSTC/gogettest latest
get "gitee.com/WuXiSTC": found meta tag get.metaImport{Prefix:"gitee.com/WuXiSTC", VCS:"git", RepoRoot:"https://gitee.com/WuXiSTC"} at //gitee.com/WuXiSTC?go-get=1
go: downloading gitee.com/WuXiSTC/gogettest v0.0.0-20200317055944-0a018ce2c5d3
go: extracting gitee.com/WuXiSTC/gogettest v0.0.0-20200317055944-0a018ce2c5d3
go get gitee.com/WuXiSTC/gogettest: git ls-remote -q origin in C:\Users\yinda\go\pkg\mod\cache\vcs\af0e04046aca702b94c562341bc781d89c9accd61a634dfbc6cfb6b22346dcfb: exit status 128:
        remote: [31mRepository Not Found[0m
        fatal: repository 'https://gitee.com/WuXiSTC/' not found
$ go env -w GOPRIVATE="gitee.com/yindaheng98"
$ go get -v gitee.com/yindaheng98/gogettest
get "gitee.com/yindaheng98/gogettest": found meta tag get.metaImport{Prefix:"gitee.com/yindaheng98/gogettest", VCS:"git", RepoRoot:"https://gitee.com/yindaheng98/gogettest.git"} at //gitee.com/yindaheng98/gogettest?go-get=1
get "gitee.com/yindaheng98": found meta tag get.metaImport{Prefix:"gitee.com/yindaheng98", VCS:"git", RepoRoot:"https://gitee.com/yindaheng98"} at //gitee.com/yindaheng98?go-get=1
go: finding gitee.com/yindaheng98/gogettest latest
go: downloading gitee.com/yindaheng98/gogettest v0.0.0-20200317060205-e8e593151786
go: extracting gitee.com/yindaheng98/gogettest v0.0.0-20200317060205-e8e593151786
go get gitee.com/yindaheng98/gogettest: git ls-remote -q origin in C:\Users\yinda\go\pkg\mod\cache\vcs\89bd5c6237dc82d2a8c7007fa783366436ede7223bff255e7c64c6fda213ebd9: exit status 128:
        remote: [31mRepository Not Found[0m
        fatal: repository 'https://gitee.com/yindaheng98/' not found

备注

设置GOPRIVATE是为了之后导入组织账号下的一些私有库,方法参考Medium

设置GOPRIVATE后go get 能正常导入github组织和个人账号下的go包:

$ go env -w GOPRIVATE="github.com/WuXiSTC"
$ go get -v github.com/WuXiSTC/gogettest
go: finding github.com/WuXiSTC/gogettest latest
go: downloading github.com/WuXiSTC/gogettest v0.0.0-20200317061134-f751fbb57753
go: extracting github.com/WuXiSTC/gogettest v0.0.0-20200317061134-f751fbb57753
$ go env -w GOPRIVATE="github.com/yindaheng98"
$ go get -v github.com/yindaheng98/gogisnet
go: finding github.com/yindaheng98/gogisnet latest
go: downloading github.com/yindaheng98/gogisnet v0.0.0-20200315152155-6727e419d182
go: extracting github.com/yindaheng98/gogisnet v0.0.0-20200315152155-6727e419d182
go: downloading github.com/yindaheng98/gogistry v0.0.0-20200314154143-3f318b478377
go: downloading github.com/yindaheng98/go-utility v0.0.0-20200309115846-83b304e8e086
go: extracting github.com/yindaheng98/go-utility v0.0.0-20200309115846-83b304e8e086
go: extracting github.com/yindaheng98/gogistry v0.0.0-20200314154143-3f318b478377
go: finding github.com/yindaheng98/gogistry v0.0.0-20200314154143-3f318b478377
go: finding github.com/yindaheng98/go-utility v0.0.0-20200309115846-83b304e8e086
total 1 participants

Comments (0)

Sign in to comment

Assignees
Labels
Not set
Projects
Milestones
Branches
Planed to start
Not set
Planed to end
Not set
Top level
Priority
Ruby
1
https://gitee.com/oschina/git-osc.git
git@gitee.com:oschina/git-osc.git
oschina
git-osc
Gitee Feedback

Help Search

220309 7019f5b6 1899542 220318 4015cbb9 1899542