go get: Git settings ignored

I'm using Golang and GitLab CI, and I've got a GitLab CI configuration which works perfectly for 12 projects, but not for a 13th.

The problem I have is that I'm trying to go get some private repositories, which go get tries to run over HTTPS, which is turned off.

The solution, that works in the other repos, is this:

git config --global url."[email protected]:".insteadOf "https://gitlab.my.site/"

However, in the runner for this one project, on the same GitLab, with the exact same config (except for the service name), this happens:

[...]
$ git config --global url."[email protected]:".insteadOf "https://gitlab.my.site/"
$ cd ${APP_PATH}
$ go get
# cd .; git clone https://gitlab.my.site/group/project.git /go/src/gitlab.my.site/group/project
Cloning into '/go/src/gitlab.my.site/group/projects'...
GitLab: The project you were looking for could not be found.
fatal: Could not read from remote repository.

Why is it suddenly trying to clone over HTTPS? It happens in this one project only, consistently, but works in all the other ones. The only reason I can think about is that this one project uses a lot of different repos, rather than just one or two, but I have a hard time seing that this would be the actual issue.

How can I troubleshoot this?

Thanks.

Upvotes: 2

Views: 997

Answers (1)

Found the answer, and it's silly, and of course, my fault. I hadn't added the deploy key to the projects, of course rejecting the clones.

To fix the problem, in GitLab, go to the repository and then "Settings" > "Repository" and fold out "Deploy keys". There, make sure that the key you're trying to clone with is available and enabled.

Upvotes: 1

Related Questions