无法使用 SSH 克隆 gitlab 存储库

问题描述 投票:0回答:1

我已经使用 ssh-keygen 生成了公钥/私钥对:

ssh-keygen -t ed25519 -C "[email protected]"

我已在 gitlab 存储库的“部署密钥”部分添加了扩展名为 .pub 的公钥内容,并确保它已“启用”。

我还将其添加到我的帐户设置中的“SSH 密钥”下。

当我尝试使用 ssh git 克隆来克隆存储库时:

git clone [email protected]:path/to/repo.git

它仍然要求输入密码,当我输入密码时,它显示“权限被拒绝”。 在重新生成不带密码的密钥后,我也尝试过不使用密码。

当我尝试指定密钥时,同样的事情:

git clone [email protected]:path/to/repo.git --config core.sshCommand="ssh -i /path/to/private_key"

ssh -vvv [email protected] -i /path/to/private_key
它说:

debug1: Offering ED25519 public key: /path/to/private_key"
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password debug1: Next authentication method: password
git ssh gitlab ssh-keys
1个回答
0
投票

Gitlab 服务器存在几个问题:

  1. 不支持ed25519,仅支持rsa
  2. 它拒绝 git 作为用户,它需要一些服务帐户名称
git clone [email protected]:path/to/repo.git --config core.sshCommand="ssh -i /path/to/private_key"
© www.soinside.com 2019 - 2024. All rights reserved.