I cloned the repository onto my PC with SSH. I got an error on the first line of the go.mod
file. The line is similar to this: module: gitlab.com/mycorporation/mycompany/susrepo
The error I got when trying to run go mod tidy
is:
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:
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? "
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:"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.