0

I'm unable to clone any repo from github using SSH. Here are console outputs:

root@local-machine ~#  git clone [email protected]:getify/You-Dont-Know-JS.git js
Cloning into 'js'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

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


root@local-machine ~#  ll ~/.ssh/
total 24
drwx------  2 root root 4096 Apr 23 12:55 ./
drwx------ 14 root root 4096 Apr 23 15:39 ../
-rw-r--r--  1 root root  738 Mar 29 15:51 authorized_keys
-rw-------  1 root root 1679 Apr 23 12:55 id_rsa
-rw-r--r--  1 root root  403 Apr 23 12:55 id_rsa.pub
-rw-r--r--  1 root root  799 Apr 23 12:55 known_hosts


root@local-machine ~#  ssh -vT [email protected]
OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to github.com [140.82.118.3] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
debug1: Remote protocol version 2.0, remote software version babeld-873429c4
debug1: no match: babeld-873429c4
debug1: Authenticating to github.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,rsa-sha2-512,rsa-sha2-256,ssh-dss>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:WMXsJVQ6YFFr6165OpgEvekJFRGzW0eUAzUq2proYI0 /root/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Trying private key: /root/.ssh/id_ecdsa
debug1: Trying private key: /root/.ssh/id_ed25519
debug1: No more authentication methods to try.
[email protected]: Permission denied (publickey).

What I'm doing wrong? Thanks

1 Answer 1

0

What I'm doing wrong?

  1. Unless your have a good reason, your first error is probably to checkout a github repo logued in as root on your local machine instead of your normal user.
  2. Have you declared your rsa public key on github GUI for your account (click on your picture > settings > SSH and GPG keys) ? The repo your trying is public so there should be no other requirements to clone it through ssh than being known to github.
  3. If you have declared a key, are you sure you did not use your personal account public rsa key instead of the one used by root (which comes back to point 1) ?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .