1

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:

Mike Abbey
  • 167
  • 1
  • 9
  • 4
    Connection reset by peer means that it cannot reach the given host. There might be a firewall in the way blocking access. Check with your local IT. – Steffen Ullrich Aug 03 '22 at 04:57

1 Answers1

-1

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:"
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250