Pulling Mod From Local Git SSH Repo

Sorry for the repetition here, but I’m getting an error that I can’t seem to get an answer from google about.

My setup is as follows. I have a locally hosted Bitbucket Server that my code lives on, and I want to be able to pull my other repos down as go mods so that I don’t need to have a mess of git submodules in all my projects. I followed the advice listed here: https://www.reddit.com/r/golang/comments/e9q2jr/private_repositories_with_onpremise_bitbucket/, which boils down to:

  1. Tell my git client to use ssh instead of https for my local repo
  2. Tell go that my-bitbucket.server is a private repo and should be exempt from the sum database and not accessed through the proxy (export GOPRIVATE=my-bitbucket.server.net’ >> ~/.zshenv)
  3. Make sure that my ssh config is set up to reach the server via ssh (already done, that’s been working for quite a while)

Everything on the Internet tells me I should be able to do a go get of my code now, but when I do that I get the following 404 error (not 410 like seems to plague most people)

go get -v my-bitbucket.server.net/proj_name/repo_name
go get my-bitbucket.server.net/proj_name/repo_name: unrecognized import path "my-bitbucket.server.net/proj_name/repo_name": reading https://my-bitbucket.server.net/proj_name/repo_name?go-get=1: 404 Not Found

I understand that go-get is supposed to provide information to the go client to tell it where to get the repo from, but I assumed that adding it to GOPRIVATE would prevent this initial lookup behavior.

My go env looks like:

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/user/Library/Caches/go-build"
GOENV="/Users/user/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/user/go/pkg/mod"
GONOPROXY="*.server.net"
GONOSUMDB="my-bitbucket.server.net"
GOOS="darwin"
GOPATH="/Users/user/go"
GOPRIVATE="*.server.net"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/user/gobin"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/user/gobin/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.17.1"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/5w/l_0n8ydd3478ysz8_59tfxf8qkd82n/T/go-build192723744=/tmp/go-build -gno-record-gcc-switches -fno-common"

go-get first send http https://my-bitbucket.server.net/proj_name/repo_name?go-get=1,response meta <meta name="go-import" content="my-bitbucket.server.net/proj_name/repo_name git https://my-bitbucket.server.net/proj_name/repo_name.git"> have repe address and verison controer tools.

Then use the meat information to pull the warehouse code; in the custom git server, you need to intercept the goget request to customize the response meta.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.