我已经使用 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
Gitlab 服务器存在几个问题:
git clone [email protected]:path/to/repo.git --config core.sshCommand="ssh -i /path/to/private_key"