尝试在golang中将私有存储库作为软件包导入。做了:
git config --global [email protected]:.insteadOf https://github.com/
因此,理论上所有对https的引用都将替换为ssh版本。
github.com/XXX/util
是我的私人仓库,是go模块。
我去得到-v并得到:
[gabriel@xiridio backend]$ go get -v
go: finding module for package github.com/XXX/util
go: downloading github.com/XXX/util v0.0.0-20200411022955-454673685ff5
go: finding module for package github.com/XXX/util
main.go:12:2: github.com/XXX/[email protected]: verifying module: github.com/XXX/[email protected]: reading https://sum.golang.org/lookup/github.com/!X!X!X/[email protected]: 410 Gone
server response:
not found: github.com/XXX/[email protected]: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /tmp/gopath/pkg/mod/cache/vcs/f1fdc5cc42a6995f954688df06783c05d28e4a60e9aaf6930a88a2487b913907: exit status 128:
fatal: could not read Username for 'https://github.com': terminal prompts disabled
似乎存在“版本”问题,并且由于某些原因,仍然引用了https。我还可以做些什么?
可以肯定的是,我更喜欢在git config命令中使用引号:
git config --global url."[email protected]:".insteadOf "https://github.com/"
请参阅此要点作为示例。
这包括:
使用的一种替代方法
[email protected]
是在GitHub帐户上生成个人访问令牌,为其授予回购访问权限,然后改为使用以下代码:git config --global url."https://${GITHUB_TOKEN}:[email protected]/".insteadOf "https://github.com/"
还要检查“ go get
导致GitHub私有存储库的'终端提示被禁用'错误 ”,其中提到了的使用GOPRIVATE
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句