Trouble with SSH keys cloning github

If I run ssh -v github.com locally I get:

OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /home/vagrant/.ssh/config
debug1: /home/vagrant/.ssh/config line 1: Applying options for github.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to github.com [***.***.***.***] port 22.
debug1: Connection established.
debug1: identity file /home/vagrant/.ssh/ansible type 1
debug1: identity file /home/vagrant/.ssh/ansible-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3
debug1: Remote protocol version 2.0, remote software version libssh-0.7.0
debug1: no match: libssh-0.7.0
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: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: RSA 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
debug1: Host ‘github.com’ is known and matches the RSA host key.
debug1: Found key in /home/vagrant/.ssh/known_hosts:3
debug1: ssh_rsa_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
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/vagrant/.ssh/ansible
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: key_parse_private2: missing begin marker
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
Authenticated to github.com ([***.***.***.***]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
PTY allocation request failed on channel 0
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
Hi eavonius! You’ve successfully authenticated, but GitHub does not provide shell access.
debug1: channel 0: free: client-session, nchannels 1
Connection to github.com closed.

If I ssh to the server I’m deploying to (it should use agent forwarding right?) I get:

OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /home/azureuser/.ssh/config
debug1: /home/azureuser/.ssh/config line 1: Applying options for github.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to github.com [***.***.***.***] port 22.
debug1: Connection established.
debug1: identity file /home/azureuser/.ssh/id_rsa type -1
debug1: identity file /home/azureuser/.ssh/id_rsa-cert type -1
debug1: identity file /home/azureuser/.ssh/id_dsa type -1
debug1: identity file /home/azureuser/.ssh/id_dsa-cert type -1
debug1: identity file /home/azureuser/.ssh/id_ecdsa type -1
debug1: identity file /home/azureuser/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/azureuser/.ssh/id_ed25519 type -1
debug1: identity file /home/azureuser/.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.3
debug1: Remote protocol version 2.0, remote software version libssh-0.7.0
debug1: no match: libssh-0.7.0
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: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: RSA 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
debug1: Host ‘github.com’ is known and matches the RSA host key.
debug1: Found key in /home/azureuser/.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: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/azureuser/.ssh/id_rsa
debug1: Trying private key: /home/azureuser/.ssh/id_dsa
debug1: Trying private key: /home/azureuser/.ssh/id_ecdsa
debug1: Trying private key: /home/azureuser/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).

Any ideas?

I’ve read these:

https://developer.github.com/guides/using-ssh-agent-forwarding/


Are you using password protected keys?

Do this

eval `ssh-agent -s`
ssh-add

on the development machine, then try again.

1 Like

Same result. SSH agent has a valid PID on both the server and the client. I’m not using password protected keys.

This is the error I get when the playbook hits that step:

failed: [IP HIDDEN] => {“cmd”: “/usr/bin/git ls-remote ‘’ -h refs/heads/master”, “failed”: true, “rc”: 128}

stderr: Permission denied (publickey).
fatal: Could not read from remote repository.

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

msg: Permission denied (publickey).

The key I use to hit the server for deployment from my vagrant VM (I’m running on Windows) is also in the server’s authorized_keys, but its not actually on the server itself. That shouldn’t matter if forwarding is setup right?

Figured it out. I had to ssh-add since I wasn’t using a default key (duh).

Fix was found walking through here: http://www.bluewire-technologies.com/2011/troubleshooting-ssh-agent-forwarding/