Skip to content

cmd/go mod falls to download dependencies due to git not using ssh #28653

Closed
@lukaskurz

Description

@lukaskurz

What version of Go are you using (go version)?

$ go version go1.11.2 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env 
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/lukas/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/lukas/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build545257636=/tmp/go-build -gno-record-gcc-switches"

What did you do?

export GO111MODULE=on in the project folder
go mod download

The repo I am pulling off is a private one and due to having 2FA i can only properly pull using ssh, not https.

What did you expect to see?

I expected it to work and download all dependencies. Apparently git failed pulling, but does not log that into the output.

What did you see instead?

$ go: finding gitlab.com/mygroup/myfolder v0.0.1
$ gitlab.com/mygroup/myfolder v0.0.1 unknown revision

$ go: error loading module requirements

How did you fix it

After pulling the problematic repo manually, I noticed that git failed pulling, so I added one of the git hacks, where it changes https://gitlab.com to [email protected]. This seemed to have fixed the problem. I think go mod should have a more verbose output, or a verbose option where it logs, that git is failing to pull.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions