【发布时间】:2020-07-23 21:43:33
【问题描述】:
尝试在 golang 中导入私有 repo 作为包。做到了:
git config --global url.git@github.com:.insteadOf https://github.com/
所以理论上所有对 https 的引用都会被 ssh 版本取代。
github.com/XXX/util
是我的私人仓库,它是一个 go 模块。
我执行 go get -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/util@v0.0.0-20200411022955-454673685ff5: verifying module: github.com/XXX/util@v0.0.0-20200411022955-454673685ff5: reading https://sum.golang.org/lookup/github.com/!X!X!X/util@v0.0.0-20200411022955-454673685ff5: 410 Gone
server response:
not found: github.com/XXX/util@v0.0.0-20200411022955-454673685ff5: 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 的引用。我还能做什么?
【问题讨论】: