title: Unable to access remote repository for Go module import
body: <p>I need to be able to import Go modules from my company's private Gitlab repository, but there's something I'm very obviously not getting about how it works.</p>
  <p>The module in question looks something like this at the top of my <code>go.mod</code> file:</p>
  <pre><code>module gitlab.domain.company.com/path/to/repository
  </code></pre>
  <p>Here's my go env:</p>
  <pre><code>set GO111MODULE=
  set GOARCH=amd64
  set GOBIN=
  set GOCACHE=C:\Users\E049839\AppData\Local\go-build
  set GOENV=C:\Users\E049839\AppData\Roaming\go\env
  set GOEXE=.exe
  set GOEXPERIMENT=
  set GOFLAGS=
  set GOHOSTARCH=amd64
  set GOHOSTOS=windows
  set GOINSECURE=
  set GOMODCACHE=C:\Users\E049839\go\pkg\mod
  set GONOPROXY=*.company.com
  set GONOSUMDB=*.company.com
  set GOOS=windows
  set GOPATH=C:\Users\E049839\go
  set GOPRIVATE=*.company.com
  set GOPROXY=https://proxy.golang.org,direct
  set GOROOT=C:\Program Files\Go
  set GOSUMDB=sum.golang.org
  set GOTMPDIR=
  set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
  set GOVCS=
  set GOVERSION=go1.19
  set GCCGO=gccgo
  set GOAMD64=v1
  set AR=ar
  set CC=gcc
  set CXX=g++
  set CGO_ENABLED=1
  set GOMOD=C:\N\the_program\go.mod
  set GOWORK=
  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 -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=C:\Users\E049839\AppData\Local\Temp\go-build416370598=/tmp/go-build -gno-record-gcc-switches
  </code></pre>
  <p>I use ssh exclusively to push and pull from the company's Gitlab, so I don't know why that would be my issue, but here's my <code>.gitconfig</code> anyway:</p>
  <pre><code>[url &quot;ssh:/git@gitlab.domain.company.com/&quot;]
      insteadOf = https://gitlab.domain.company.com/
  [url &quot;ssh:/git@gitlab.company.com/&quot;]
      insteadOf = https://gitlab.company.com/
  </code></pre>
  <p>Any time I try to <code>go build</code> or <code>go get</code> for this project, I'm given this error:</p>
  <pre><code>go: gitlab.domain.company.com/path/to/lib: unrecognized import path &quot;gitlab.domain.company.com/path/to/lib&quot;: https fetch: Get &quot;https://gitlab.domain.company.com/path/to/lib?go-get=1&quot;: dial tcp xx.xx.xxx.xxx:xxx: connectex: No connection could be made because the target machine actively refused it.
  </code></pre>
  <p>Some info redacted obviously.</p>
  <p>My version of Go is 1.19 running on Windows. I'm out of ideas trying to fool with this module, to the extent that I'm considering rewriting the entire application in a language with sensible version control.</p>