`go get` issue finding private module

Having issues importing a private module, listed the debug+verbose log, can’t figure out why…:

$ go get -x -v private-gitlab.com/orgname/subgroup/myproject-go
# get https://private-gitlab.com/orgname/subgroup/myproject-go?go-get=1
# get https://private-gitlab.com/orgname/subgroup/myproject-go?go-get=1: 200 OK (0.095s)
get "private-gitlab.com/orgname/subgroup/myproject-go": found meta tag vcs.metaImport{Prefix:"private-gitlab.com/orgname/subgroup", VCS:"git", RepoRoot:"https://private-gitlab.com/orgname/subgroup.git"} at //private-gitlab.com/orgname/subgroup/myproject-go?go-get=1
get "private-gitlab.com/orgname/subgroup/myproject-go": verifying non-authoritative meta tag
# get https://private-gitlab.com/orgname/subgroup?go-get=1
# get https://private-gitlab.com/orgname/subgroup?go-get=1: 200 OK (0.038s)
mkdir -p /home/username/go/pkg/mod/cache/vcs # git3 https://private-gitlab.com/orgname/subgroup.git
# lock /home/username/go/pkg/mod/cache/vcs/5992a5e5b7a53bbdd91113a9673fe0b4d486cf6d2db09a1dc466f05595aeb817.lock
# /home/username/go/pkg/mod/cache/vcs/5992a5e5b7a53bbdd91113a9673fe0b4d486cf6d2db09a1dc466f05595aeb817 for git3 https://private-gitlab.com/orgname/subgroup.git
cd /home/username/go/pkg/mod/cache/vcs/5992a5e5b7a53bbdd91113a9673fe0b4d486cf6d2db09a1dc466f05595aeb817; git ls-remote -q origin
1.919s # cd /home/username/go/pkg/mod/cache/vcs/5992a5e5b7a53bbdd91113a9673fe0b4d486cf6d2db09a1dc466f05595aeb817; git ls-remote -q origin
# get https://private-gitlab.com/orgname/subgroup.git
# get https://private-gitlab.com/orgname/subgroup.git: 200 OK (0.094s)
go: module private-gitlab.com/orgname/subgroup/myproject-go: git ls-remote -q origin in /home/username/go/pkg/mod/cache/vcs/5992a5e5b7a53bbdd91113a9673fe0b4d486cf6d2db09a1dc466f05595aeb817: exit status 128:
        remote: 
        remote: ========================================================================
        remote: 
        remote: The project you were looking for could not be found or you don't have permission to view it.
        remote: 
        remote: ========================================================================
        remote: 
        fatal: Could not read from remote repository.

        Please make sure you have the correct access rights
        and the repository exists.

Both of the following work:

git clone git@private-gitlab.com:orgname/subgroup/myproject-go.git
git clone https://private-gitlab.com/orgname/subgroup/myproject-go.git

Have this enabled in my global .gitconfig.

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

Did not set up .netrc as I would rather it work with ssh…

I think I just found that this issue might be on GitLab’s side…

EDIT: Until that gets resolved, using .netrc is the solution, as explained in this section of the Github Gist here.

Solved it myself by just replacing the ssh setup with .netrc.

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