go get:Git设置被忽略 [英] go get: Git settings ignored

查看:339
本文介绍了go get:Git设置被忽略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Golang和GitLab CI,并且我有一个GitLab CI配置,它可以完美地用于12个项目,但不适用于第13个项目.

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.

我遇到的问题是,我正在尝试go get一些私有存储库,而go get试图在HTTPS上运行该存储库,该存储库已关闭.

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."git@gitlab.my.site:".insteadOf "https://gitlab.my.site/"

但是,在该项目的运行器中,在具有完全相同的配置(服务名称除外)的同一GitLab上,会发生这种情况:

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."git@gitlab.my.site:".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.

为什么突然尝试通过HTTPS进行克隆?它仅在一个项目中始终如一地发生,但在其他所有项目中都起作用.我能想到的唯一原因是,这个项目使用很多不同的存储库,而不仅仅是一个或两个,但是我很难理解这将是实际的问题.

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.

如何解决此问题?

谢谢.

推荐答案

找到了答案,这很愚蠢,当然是我的错.我没有将部署密钥添加到项目中,当然拒绝了克隆.

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.

要解决此问题,请在GitLab中转到存储库,然后转到设置">存储库",然后展开部署密钥".在那里,请确保您要用来克隆的密钥是可用的并已启用.

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.

这篇关于go get:Git设置被忽略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆