与gitlab的SSH连接

时间:2014-09-07 16:24:26

标签: ssh gitlab

我无法通过SSH克隆gitlab上托管的存储库(https工作正常)。 公钥已通过Web界面提交给gitlab,但服务器由于某种原因不接受提供的密钥,而是返回密码验证。奇怪的是,ssh auth可以在其他服务器上运行,所以我假设我需要在ssh_config中更改某些内容以使其与gitlab一起使用。我很感激就此事提出一些建议。

ssh -vT log打印以下内容:

OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to domain [172.16.64.85] port 22.
debug1: Connection established.
debug1: could not open key file '/etc/ssh/ssh_host_key': No such file or directory
debug1: could not open key file '/etc/ssh/ssh_host_dsa_key': Permission denied
debug1: could not open key file '/etc/ssh/ssh_host_ecdsa_key': Permission denied
debug1: could not open key file '/etc/ssh/ssh_host_rsa_key': Permission denied
debug1: could not open key file '/etc/ssh/ssh_host_ed25519_key': Permission denied
debug1: could not open key file '/etc/ssh/ssh_host_dsa_key': Permission denied
debug1: could not open key file '/etc/ssh/ssh_host_ecdsa_key': Permission denied
debug1: could not open key file '/etc/ssh/ssh_host_rsa_key': Permission denied
debug1: could not open key file '/etc/ssh/ssh_host_ed25519_key': Permission denied
debug1: identity file /home/ja/.ssh/id_rsa type 1
debug1: identity file /home/ja/.ssh/id_rsa-cert type -1
debug1: identity file /home/ja/.ssh/id_dsa type -1
debug1: identity file /home/ja/.ssh/id_dsa-cert type -1
debug1: identity file /home/ja/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/ja/.ssh/id_ed25519 type -1
debug1: identity file /home/ja/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.4
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.4 pat OpenSSH_5* compat 0x0c000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA b6:a4:91:33:80:c3:46:82:e2:4e:21:be:7e:a0:b0:c5
debug1: Host 'domain' is known and matches the ECDSA host key.
debug1: Found key in /home/ja/.ssh/known_hosts:1
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/ja/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/ja/.ssh/id_dsa
debug1: Trying private key: /home/ja/.ssh/id_ecdsa
debug1: Trying private key: /home/ja/.ssh/id_ed25519
debug1: Next authentication method: password
git@domains's password: 

1 个答案:

答案 0 :(得分:0)

确保您的公共ssh密钥已在GitLab帐户中正确注册(作为一个连续的行)。

例如,GitLab SSH troubleshooting page提到如果在设置GitLab之前公钥已经在~/.ssh/authorized_keys中,或者authorized_keys文件不同步,它将无法工作