Skip to content

unable to install go module (private nested repository)

Summary

When using go modules, I cannot install a module - private gitlab repository that is nested within a subgroup. This was originally discussed here: https://gitlab.com/gitlab-org/gitlab-ce/issues/37832, but the workaround specified there doesn't seem to work with go modules.

Steps to reproduce

  1. Install GoLang 1.12 or 1.13beta1
  2. Create a private organisation in Gitlab
  3. Create a private subgroup in the organisation
  4. Create a private repository in the subgroup
  5. Clone the repository locally
  6. cd to the repository
  7. Initialise new go module go mod init gitlab.com/myorganisation/mysubgroup/myrepository
  8. Commit and push
  9. cd to another go modules enabled repository
  10. Run go get gitlab.com/myorganisation/mysubgroup/myrepository

What is the current bug behavior?

go get -v gitlab.com/myorganisation/mysubgroup/repo1
falnyr@macbook:/Volumes/CS/myorganisation/mysubgroup/repo2  git:(master*) $ go get -v gitlab.com/myorganisation/mysubgroup/repo1
get "gitlab.com/myorganisation/mysubgroup/repo1": found meta tag get.metaImport{Prefix:"gitlab.com/myorganisation/mysubgroup", VCS:"git", RepoRoot:"https://gitlab.com/myorganisation/mysubgroup.git"} at //gitlab.com/myorganisation/mysubgroup/repo1?go-get=1
get "gitlab.com/myorganisation/mysubgroup/repo1": verifying non-authoritative meta tag
get "gitlab.com/myorganisation/mysubgroup": found meta tag get.metaImport{Prefix:"gitlab.com/myorganisation/mysubgroup", VCS:"git", RepoRoot:"https://gitlab.com/myorganisation/mysubgroup.git"} at //gitlab.com/myorganisation/mysubgroup?go-get=1
go get gitlab.com/myorganisation/mysubgroup/repo1: git ls-remote -q https://gitlab.com/myorganisation/mysubgroup.git in /Volumes/CS/go/pkg/mod/cache/vcs/a96c83d4d1395bc931a1a8ac402e8d8e494cc85efa9081cab02316963aa836ed: exit status 128:
        The project you were looking for could not be found.
        fatal: Could not read from remote repository.
        
        Please make sure you have the correct access rights
        and the repository exists.
go get -v gitlab.com/myorganisation/mysubgroup/repo1.git
falnyr@macbook:/Volumes/CS/myorganisation/mysubgroup/repo2  git:(master*) $ go get -v gitlab.com/myorganisation/mysubgroup/repo1.git
go: finding gitlab.com/myorganisation/mysubgroup/repo1.git latest
verifying gitlab.com/myorganisation/mysubgroup/repo1.git@v0.0.0-20190805075344-8b58ae60a5dc/go.mod: gitlab.com/myorganisation/mysubgroup/repo1.git@v0.0.0-20190805075344-8b58ae60a5dc/go.mod: reading https://sum.golang.org/lookup/gitlab.com/myorganisation/mysubgroup/repo1.git@v0.0.0-20190805075344-8b58ae60a5dc: 410 Gone
go get -v gitlab.com/myorganisation/mysubgroup.git/repo1
falnyr@macbook:/Volumes/CS/myorganisation/mysubgroup/repo2  git:(master*) $ go get -v gitlab.com/myorganisation/mysubgroup.git/repo1
# cd .; git ls-remote -- https://gitlab.com/myorganisation/mysubgroup
The project you were looking for could not be found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
# cd .; git ls-remote -- git+ssh://gitlab.com/myorganisation/mysubgroup
falnyr@gitlab.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
# cd .; git ls-remote -- ssh://gitlab.com/myorganisation/mysubgroup
falnyr@gitlab.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
# cd .; git ls-remote -- https://gitlab.com/myorganisation/mysubgroup
The project you were looking for could not be found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
# cd .; git ls-remote -- git+ssh://gitlab.com/myorganisation/mysubgroup
falnyr@gitlab.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
# cd .; git ls-remote -- ssh://gitlab.com/myorganisation/mysubgroup
falnyr@gitlab.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
go get gitlab.com/myorganisation/mysubgroup.git/repo1: git ls-remote -q git://gitlab.com/myorganisation/mysubgroup in /Volumes/CS/go/pkg/mod/cache/vcs/9ac3b087a6858becb7557051f722eb295aa7aa124d78647bf6c39917ed30740a: exit status 128:
        fatal: unable to connect to gitlab.com:
        gitlab.com[0: 35.231.145.151]: errno=Operation timed out

What is the expected correct behavior?

Regardless of the project nesting, provide consistent result - allow the module to be installed.