0

Steps to reproduce

  • Install Go 1.14
  • Create a private organisation in Gitlab
  • Create a private subgroup in the organisation
  • Create a private repository in the subgroup
  • Clone the repository locally
  • cd to the repository
  • Initialise new go module go mod init gitlab.com/myorganisation/mysubgroup/myrepository
  • Commit and push
  • cd to another go modules enabled repository
  • Run go get gitlab.com/myorganisation/mysubgroup/myrepository

Got error:

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.
Ubik
  • 9
  • 2

1 Answers1

-1
  1. ~/.gitconfig:
    [url "git@gitlab.com:"]
        insteadOf = https://gitlab.com/

1.Set envs:

    GONOPROXY="gitlab.com/mycorp/*"
    GONOSUMDB="gitlab.com/mycorp/*"
    GOPRIVATE="gitlab.com/mycorp/*"
  1. In go.mod file change path of your subgroup repo from "gitlab.com/myorganisation/mysubgroup/myrepository" to "gitlab.com/myorganisation/mysubgroup/myrepository.git". Same for all subgroup repo import paths.

  2. Go to your previous repository that requires above subgroup repo and call "go get -insecure gitlab.com/myorganisation/mysubgroup/myrepository.git"

After that go.mod must be updated and everything will start work fine.

Ubik
  • 9
  • 2
  • You should not be setting `GONOPROXY` or `GONOSUMDB`. Setting `GOPRIVATE` alone is sufficient. And the correct value would be simply: `GOPRIVATE=gitlab.com/mycorp` – Jonathan Hall Sep 17 '20 at 07:41