当尝试从github安装模块时,Go install命令显示404错误



我开发了一个go模块,并将其推送到github,当我试图用go install命令安装它时,它显示

go: downloading github.com/hvuhsg/lokidbServer v0.0.0-20220825205442-250079f3d6e9
go: github.com/hvuhsg/lokidbServer/cmd/lokidb.go@latest: github.com/hvuhsg/lokidbServer@v0.0.0-20220825205442-250079f3d6e9: verifying module: github.com/hvuhsg/lokidbServer@v0.0.0-20220825205442-250079f3d6e9: reading https://sum.golang.org/lookup/github.com/hvuhsg/lokidb!server@v0.0.0-20220825205442-250079f3d6e9: 404 Not Found
server response:
not found: github.com/hvuhsg/lokidbServer@v0.0.0-20220825205442-250079f3d6e9: invalid version: git ls-remote -q origin in /tmp/gopath/pkg/mod/cache/vcs/023bef7fbf7701c1dd80019746ac35a6d71aa94fa9b3961e0dadef371238a56e: exit status 128:
fatal: could not read Username for 'https://github.com': terminal prompts disabled
Confirm the import path was entered correctly.
If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.

p.S:回购是公开

完整的命令是

go install github.com/hvuhsg/lokidbServer/cmd/lokidb.go@latest

您可以这样安装它:go install github.com/hvuhsg/lokidbServer/cmd@latest

如果repo是你的,我建议在cmd文件夹中添加一个文件夹lokidb,并将主包放在其中。

以这个回购为例:

go install github.com/fraugster/parquet-go/cmd/csv2parquet@latest

另一种选择是将文件添加到目录的根目录中,就像这里所做的那样(在这种情况下,go.mod中的包被定义为github.com/vektra/mockery/v2(:

go install github.com/vektra/mockery/v2@latest

我遇到了同样的问题,但过了一段时间,问题自动解决了。我的印象是缓存出现了问题。

尝试:

go list-m-版本github.com/username/module

最新更新