登录
首页 >  Golang >  Go问答

go.mod 错误:退出状态 128,连接被对等方重置

来源:stackoverflow

时间:2024-02-12 18:03:23 294浏览 收藏

学习Golang要努力,但是不要急!今天的这篇文章《go.mod 错误:退出状态 128,连接被对等方重置》将会介绍到等等知识点,如果你想深入学习Golang,可以关注我!我会持续更新相关文章的,希望对大家都能有所帮助!

问题内容

我使用 ssh 将存储库克隆到我的 pc 上。我在 go.mod 文件的第一行出现错误。该行类似于: module: gitlab.com/mycorporation/mycompany/susrepo

尝试运行 go mod tidy 时遇到的错误是:

go: gitlab.com/mycorporation/mycompany/dat/[email protected]: reading gitlab.com/mycorporation/mycompany/dat/go-kafkautil.git/go.mod at revision v0.0.3: git ls-remote -q origin in /home/sususer/go/pkg/mod/cache/vcs/9572610d568gv0dca638cbb8aaf8843db7465c89ce962998ae8516eb93beb2e3: exit status 128:
        fatal: read error: Connection reset by peer
go: downloading gitlab.com/mycorporation/mycompany/dat/go-kafkautil.git v0.0.3
go: gitlab.com/mycorporation/mycompany/dat/[email protected]: reading gitlab.com/mycorporation/mycompany/dat/go-kafkautil.git/go.mod at revision v0.0.3: git ls-remote -q origin in /home/sususer/go/pkg/mod/cache/vcs/9572610d568gv0dca638cbb8aaf8843db7465c89ce962998ae8516eb93beb2e3: exit status 128:
        fatal: read error: Connection reset by peer

即使我没有运行 run go mod tidy,将光标指向上述第一行也会出现类似的错误,开头有这些附加文本:err: exit status 1: stderr:


正确答案


检查 git ls-remote -v origingitlab.com/mycorporation/mycompany/dat/go-kafkautil.git 中返回的内容(位于 $gopath/pkg/mod$home/go/pkg/mod 中)。

根据 url,您可能必须从 ssh 切换到 https,反之亦然,如“What's the proper way to "go get" a private repository?”中所示

例如:

git config --global url."[email protected]:".insteadOf "https://gitlab.mycompany.com/"
# or
git config --global url."https://gitlab.mycompany.com/".insteadOf "[email protected]:"

今天关于《go.mod 错误:退出状态 128,连接被对等方重置》的内容就介绍到这里了,是不是学起来一目了然!想要了解更多关于的内容请关注golang学习网公众号!

声明:本文转载于:stackoverflow 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
最新阅读
更多>
课程推荐
更多>