Hi everyone,
I’m trying to clone a repository from Gitlab into a new server, and I’m running into an issue. I’ve created an SSH key (standard name/location, no password) and copied it to Gitlab, but when I try to clone my project directory I get the following message:
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
By doing some searches I’ve seen a few suggested solutions, but I haven’t had success with any:
- If I run “ssh-add -l”, I get the following message:
Could not open a connection to your authentication agent.
I found a solution suggesting to run:
eval “$(ssh-agent -s)”
ssh-add
The results are:
Agent pid 23602
Identity added: /XXXX/.ssh/id_rsa (/XXXX/.ssh/id_rsa)
And while this adds the correct identity, I still get the same error after git clone.
- Run “ssh -vT git@gitlab.com”. Here is the output from that command:
$ ssh -vT git@gitlab.com
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /XXXX/.ssh/config
debug1: Applying options for gitlab.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to gitlab.com [104.210.2.228] port 22.
debug1: Connection established.
debug1: identity file /XXXX/.ssh/id_rsa type 1
debug1: identity file /XXXX/.ssh/id_rsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.1
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1 none
debug1: kex: client->server aes128-ctr hmac-sha1 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<2048<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host ‘gitlab.com’ is known and matches the RSA host key.
debug1: Found key in /XXXX/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).
I’m not sure exactly where to go from here, as it seems like SSH is not trying the publickey. Any help would be greatly appreciated!