Skip to content

go get or go mod with private repositories over ssh #64389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
shaneHowearth opened this issue Nov 26, 2023 · 4 comments
Closed
1 task done

go get or go mod with private repositories over ssh #64389

shaneHowearth opened this issue Nov 26, 2023 · 4 comments

Comments

@shaneHowearth
Copy link

Go version

go version go1.21.4 linux/arm64

Reproducibility

  • Does this issue reproduce with the latest release?

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

GO111MODULE=''
GOARCH='arm'
GOBIN=''
GOCACHE='/home/shane/.cache/go-build'
GOENV='/home/shane/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/shane/go/pkg/mod'
GONOPROXY='shanehowearth.com'
GONOSUMDB='shanehowearth.com'
GOOS='linux'
GOPATH='/home/shane/go'
GOPRIVATE='shanehowearth.com'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_arm64'
GOVCS=''
GOVERSION='go1.21.4'
GCCGO='gccgo'
GOARM='7'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='0'
GOMOD='/home/shane/go/src/shanehowearth.com/onepage/api/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -marm -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build4248562263=/tmp/go-build -gno-record-gcc-switches'

What did you do?

I have created a private git repository on my VPC - and it is available via SSH

I can git clone the repository just fine, but I cannot go get shanehowearth.com/project/repo.git and as soon as I try to import a package from within the repo (eg project/repo.git/package/) I get errors

What did you expect to see?

I expect to be able to use the module hosted on my VPS just like any other go module.

What did you see instead?

0.826 repo.go:8:2: no required module provides package shanehowearth.com/project/repo.git/grpc/client/v1; to add it:
0.826 go get shanehowearth.com/project/repo.git/grpc/client/v1
0.826 repo.go:9:2: no required module provides package shanehowearth.com/project/repo.git/grpc/proto/v1; to add it:
0.826 go get shanehowearth.com/project/repo.git/grpc/proto/v1

Dockerfile:15

13 |
14 | # build time
15 | >>> RUN GOPRIVATE=shanehowearth.com CGO_ENABLED=0 GOOS=linux go build -v -o /go/bin/api cmd/*.go
16 |
17 | FROM scratch

ERROR: failed to solve: process "/bin/sh -c GOPRIVATE=shanehowearth.com CGO_ENABLED=0 GOOS=linux go build -v -o /go/bin/api cmd/*.go" did not complete successfully: exit code: 1
make: *** [Makefile:2: docker] Error 1
shane@raspberrypi ~/go/src/shanehowearth.com/project/api main ! GOPRIVATE=shanehowearth.com go get shanehowearth.com/project/repo.git/grpc/client/v1
go: shanehowearth.com/project/repo.git/grpc/client/v1: module shanehowearth.com/project/repo.git/grpc/client: git ls-remote -q origin in /home/shane/go/pkg/mod/cache/vcs/8e94b8a1ff4a9110d6f80a0b032164dc170cd0de07cc65b1945b9dd0a98feab6: exit status 128:
fatal: unable to connect to shanehowearth.com:
shanehowearth.com[0: 81.4.127.22]: errno=Connection refused
shane@raspberrypi ~/go/src/shanehowearth.com/project/api main ! GOPRIVATE=shanehowearth.com go get shanehowearth.com/project/repo/grpc/client/v1
go: shanehowearth.com/project/repo/grpc/client/v1: unrecognized import path "shanehowearth.com/project/repo/grpc/client": reading https://shanehowearth.com/project/repo/grpc/client?go-get=1: 404 Not Found
server response: 404 page not found
shane@raspberrypi ~/go/src/shanehowearth.com/project/api main ! GOPRIVATE=shanehowearth.com go get shanehowearth.com/project/repo/grpc/client/v1.git
go: module shanehowearth.com/project/repo/grpc/client/v1.git: git ls-remote -q origin in /home/shane/go/pkg/mod/cache/vcs/403cc645b5880635cb36ea2d7c06d2b413e94c687e6e883dc603f902890bba00: exit status 128:
fatal: unable to connect to shanehowearth.com:
shanehowearth.com[0: 81.4.127.22]: errno=Connection refused

@shaneHowearth
Copy link
Author

I had thought that I'd solved this by using repo.git instead of repo but it seems not

I have the same issue on my raspberry pi, and on my desktop machine (which is using a slightly older go
$ go version
go version go1.21.0 linux/amd64
)

I suspect that the issue is to do with the fact that I am using ssh only to access the repository, but it shouldn't affect things :(

@seankhliao
Copy link
Member

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For questions please refer to https://github.com/golang/go/wiki/Questions

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Nov 26, 2023
@shaneHowearth
Copy link
Author

Although this is styled as an open question, it points to a possible bug with the VCS system, I'd appreciate it if you didn't arbitrarily close something like that without discussion.

@shaneHowearth
Copy link
Author

I firmly believe that this and #64223 are similar enough, in fact I'd say that my report is a confirmation that the issue exists in current versions

@golang golang locked and limited conversation to collaborators Nov 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants