Skip to content
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

cmd/go: cannot fetch gitlab repo using git:// using insteadOf (macOS git 2.19.1) #28422

Closed
denisemauldin opened this issue Oct 26, 2018 · 3 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@denisemauldin
Copy link

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

go 1.11.1 darwin/amd64

Does this issue reproduce with the latest release?

yes

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/dmauldin/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/dmauldin/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.11.1/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.11.1/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/_t/sfww_0f53kl1_9x3hj3p5d100000gn/T/go-build553492779=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do? What did you expect to see? What did you see instead?

Installed go and attempted to use go get to fetch a gitlab repository via git:// instead of https://

I found this URL: #6968

I added a git config for my URL.

[url "git@gitlab.<myhost>:"]
    insteadOf = https://gitlab.<myhost>/

Running go get gitlab.<myhost>/blah/blah.git returns unrecognized import path with the https url still in the https fetch (which gets a connection refused). Is insteadOf still the correct way to do this as per the linked issue?

@andybons
Copy link
Member

Hi @denisemauldin,
Can you paste the output of go get -u -v gitlab.<myhost>/path/to/pkg?

What is the output of curl https://gitlab.<myhost>/path/to/pkg?go-get=1?

On gitlab.com, it returns a meta tag for the go command regardless of whether the package even exists or whether you're logged in:

$ curl https://gitlab.com/andybons/pkg?go-get=1
<html><head><meta name="go-import" content="gitlab.com/andybons/pkg git https://gitlab.com/andybons/pkg.git" /></head></html>

With the following settings in my .gitconfig, insteadOf appears to work for me when I attempt to download a private package of mine at gitlab:

[url "git@gitlab.com:"]
	insteadOf = https://gitlab.com/

This leads me to believe that git isn't broken (I'm using 2.19.1 as well) But I don't have access to a custom host, so it's difficult for me to diagnose further.

@andybons andybons added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Oct 26, 2018
@andybons andybons added this to the Unplanned milestone Oct 26, 2018
@andybons andybons changed the title insteadOf broken with MacOS git 2.19.1 and go version 1.11.1? cmd/go: cannot fetch gitlab repo using git:// using insteadOf (macOS git 2.19.1) Oct 26, 2018
@denisemauldin
Copy link
Author

@andybons Here's the output for your questions. Our host is internal/local and does not support https, which is why I'm trying to change git from using https:// to git://. Thanks.

09:56 $ go get -u -v gitlab.myhost/myteam/myproject.git
gitlab.myhost/myteam/myproject.git (download)
github.com/Masterminds/sprig (download)
github.com/Masterminds/semver (download)
github.com/aokoli/goutils (download)
github.com/google/uuid (download)
github.com/huandu/xstrings (download)
github.com/imdario/mergo (download)
Fetching https://golang.org/x/crypto/scrypt?go-get=1
Parsing meta tags from https://golang.org/x/crypto/scrypt?go-get=1 (status code 200)
get "golang.org/x/crypto/scrypt": found meta tag get.metaImport{Prefix:"golang.org/x/crypto", VCS:"git", RepoRoot:"https://go.googlesource.com/crypto"} at https://golang.org/x/crypto/scrypt?go-get=1
get "golang.org/x/crypto/scrypt": verifying non-authoritative meta tag
Fetching https://golang.org/x/crypto?go-get=1
Parsing meta tags from https://golang.org/x/crypto?go-get=1 (status code 200)
golang.org/x/crypto (download)
Fetching https://golang.org/x/crypto/pbkdf2?go-get=1
Parsing meta tags from https://golang.org/x/crypto/pbkdf2?go-get=1 (status code 200)
get "golang.org/x/crypto/pbkdf2": found meta tag get.metaImport{Prefix:"golang.org/x/crypto", VCS:"git", RepoRoot:"https://go.googlesource.com/crypto"} at https://golang.org/x/crypto/pbkdf2?go-get=1
get "golang.org/x/crypto/pbkdf2": verifying non-authoritative meta tag
github.com/aws/aws-xray-sdk-go (download)
github.com/aws/aws-sdk-go (download)
github.com/cihub/seelog (download)
github.com/pkg/errors (download)
github.com/go-chi/render (download)
github.com/gofrs/uuid (download)
Fetching https://gitlab.myhost/myteam/myproject/pkg/task?go-get=1
https fetch failed: Get https://gitlab.myhost/myteam/myproject/pkg/task?go-get=1: dial tcp 10.X.X.X:443: connect: connection refused
gitlab.myhost/myteam/myproject (download)
# cd /Users/dmauldin/go/src/gitlab.myhost/myteam/mypackage; git pull --ff-only
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> updated_docs

package gitlab.myhost/myteam/myproject/pkg/task: exit status 1

What is the output of curl https://gitlab.<myhost>/path/to/pkg?go-get=1?

Our host does not support https. curl: (7) Failed to connect to gitlab.myhost port 443: Connection refused

@andybons
Copy link
Member

@denisemauldin Thank you for following up with the output. The issue is that your server does not support SSL/TLS (https) so it can't get at the meta tags needed by the go command to even use the git:// URL. My advice would be to encourage whomever administrates the local server to enable https://.

I'm sorry that I don't have a better solution for you. More context can be found at #27254 (comment)

Closing out for now. Please comment if you feel this was in error.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants