简体   繁体   English

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

[英]go.mod errors: exit status 128, connection reset by peer

I cloned the repository onto my PC with SSH.我使用 SSH 将存储库克隆到我的 PC 上。 I got an error on the first line of the go.mod file.我在go.mod文件的第一行出现错误。 The line is similar to this: module: gitlab.com/mycorporation/mycompany/susrepo该行与此类似: module: gitlab.com/mycorporation/mycompany/susrepo

The error I got when trying to run go mod tidy is:我在尝试运行go mod tidy时遇到的错误是:

go: gitlab.com/mycorporation/mycompany/dat/go-kafkautil@v0.0.3: 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/go-kafkautil@v0.0.3: 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

Even when I did not run run go mod tidy , pointing the cursor to the mentioned first line gives similar error, with these additional text at the beginning: err: exit status 1: stderr:即使我没有运行运行go mod tidy ,将 cursor 指向提到的第一行也会产生类似的错误,开头有这些附加文本: err: exit status 1: stderr:

Check what git ls-remote -v origin returns in gitlab.com/mycorporation/mycompany/dat/go-kafkautil.git in $GOPATH/pkg/mod , or $HOME/go/pkg/mod . Check what git ls-remote -v origin returns in gitlab.com/mycorporation/mycompany/dat/go-kafkautil.git in $GOPATH/pkg/mod , or $HOME/go/pkg/mod .

Depending on the URL, you might have to switch from SSH to HTTPS or vice versa, as illustrated in " What's the proper way to " go get " a private repository? " Depending on the URL, you might have to switch from SSH to HTTPS or vice versa, as illustrated in " What's the proper way to " go get " a private repository? "

For instance:例如:

git config --global url."git@gitlab.mycompany.com:".insteadOf "https://gitlab.mycompany.com/"
# or
git config --global url."https://gitlab.mycompany.com/".insteadOf "git@gitlab.mycompany.com:"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM