I have configured ssh properly and I can do git stuff with our private repo via ssh. But when I tested with go get
or go test
(for go modules) the cli is not using ssh but instead using https.
.gitconfig
[url "ssh://[email protected]:7999"]
insteadOf = https://bitbucket.company.com/scm
~/.ssh/config
Host bitbucket.company.com
User git
Port 7999
IdentityFile ~/.ssh/id_rsa
testing if ssh works
$ git ls-remote ssh://[email protected]:7999/project/repo.git
ab86e12ab20775a308b7d0b003ba562263fbfa23 HEAD
ab86e12ab20775a308b7d0b003ba562263fbfa23 refs/heads/master
ab86e12ab20775a308b7d0b003ba562263fbfa23 refs/tags/v0.0.1
testing go get
$ go get -v bitbucket.company.com/project/repo
go get bitbucket.company.com/project/repo: unrecognized import path "bitbucket.company.com/project/repo": https fetch: Get "https://bitbucket.company.com/project/repo?go-get=1": dial tcp 10.68.204.3:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
go version
go version go1.14.1 windows/amd64
go env
set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\sailhenz\AppData\Local\go-build
set GOENV=C:\Users\sailhenz\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GONOPROXY=none
set GONOSUMDB=*.company.com
set GOOS=windows
set GOPATH=C:\Users\sailhenz\Documents\Development\Go
set GOPRIVATE=*.company.com
set GOPROXY=https://goproxy.io,direct
set GOROOT=C:\Users\sailhenz\Documents\Software\go
set GOSUMDB=off
set GOTMPDIR=
set GOTOOLDIR=C:\Users\sailhenz\Documents\Software\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=NUL
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\sail~1\AppData\Local\Temp\go-build227330694=/tmp/go-build -gno-record-gcc-switches
Any setup/configuration I missed? Thanks in advance.
bitbucket.company.com/project/repo
does not match witchhttps://bitbucket.company.com/scm
. – Calculator.git
in the import path resolves it. Link of the thread here github.com/golang/go/issues/27254 for anyone with the same issues. – Plaintiff.git
in said import path. – Plastid