即使 ssh 有效,Gitlab 也无法克隆存储库

Gitlab can't clone repository even though ssh works

如标题所述,即使 ssh 似乎有效,我也无法从 Gitlab 6 服务器克隆存储库。

尝试克隆时,它看起来像这样:

git clone ssh://git@domain.de:1337/project/repository.git
Cloning into 'repository'...
Access denied.
fatal: Could not read from remote repository.

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

在项目中,我的角色是"developer",应该有克隆仓库的权限?

我还检查了我的 SSH public 密钥是否正常工作

ssh git@domain.de -p 1337 -T
Welcome to GitLab, Anonymous!

更让我恼火的是,我的一个朋友似乎一切正常。

编辑: 此处所述问题的主要指标是来自 SSH 测试的问候语。在工作环境中,它应该用你的名字而不是 Anonymous 来问候你!

尝试类似 scp 的语法:

git clone ssh://git@domain.de:1337:project/repository.git

实际上强制,这意味着url可以简化为gitlab:project/repositoriy.git

但结果证明是 gitlab 服务器 ~gitlab/.ssh/authorized_keys 中的 ssh 密钥问题(有点像 issue 4730)。
OP Gelix confirms :

I removed my key from Gitlab, manually from authorized_keys, readded it on Gitlab. Everything fine now.
Message with SSH Test is now also Welcome to GitLab, Felix *****!

(而不是 Welcome to GitLab, Anonymous!

最近我的私人 GitLab-CE 托管服务器遇到了同样的问题。重新配置 GitLab 救了我。我试过编辑本地配置文件并添加主机,但没有用。这对我有用。

sudo gitlab-ctl reconfigure