git - Github: Permission denied (publickey) but I got "You've successfully authenticated" message -


step had done: https://help.github.com/articles/generating-ssh-keys/ follow exactly.

$ eval "$(ssh-agent -s)" agent pid 31944 $ ssh-add enter passphrase /home/centos7/.ssh/id_rsa: identity added: /home/centos7/.ssh/id_rsa (/home/centos7/.ssh/id_rsa)  $ ssh-add -l 4096 ab:4d:23:23:99:ce:bb:9d:9f:9e:f9:b2:c8:1a:cd:f7 /home/centos7/.ssh/id_rsa (rsa) 

however, when run

$ git clone git@github.com:privaterepo/repo.git  cloning 'repo'... authenticity of host 'github.com (192.30.252.130)' can't established. rsa key fingerprint 56:27:ac:a5:36:28:2d:36:23:1b:56:4d:eb:df:a6:48. sure want continue connecting (yes/no)? yes warning: permanently added 'github.com,192.30.252.130' (rsa) list of known hosts. permission denied (publickey). fatal: not read remote repository. 

below output run

$ ssh -tv git@github.com  openssh_6.6.1, openssl 1.0.1e-fips 11 feb 2013 debug1: reading configuration data /home/centos7/.ssh/config debug1: /home/centos/.ssh/config line 1: applying options *github.com debug1: reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 56: applying options * debug1: connecting github.com [192.30.252.131] port 22. debug1: connection established. debug1: identity file /home/centos7/.ssh/id_rsa type 1 debug1: identity file /home/centos7/.ssh/id_rsa-cert type -1 debug1: identity file /home/centos7/.ssh/id_dsa type -1 debug1: identity file /home/centos7/.ssh/id_dsa-cert type -1 debug1: identity file /home/centos7/.ssh/id_ecdsa type -1 debug1: identity file /home/centos7/.ssh/id_ecdsa-cert type -1 debug1: identity file /home/centos7/.ssh/id_ed25519 type -1 debug1: identity file /home/centos7/.ssh/id_ed25519-cert type -1 debug1: enabling compatibility mode protocol 2.0 debug1: local version string ssh-2.0-openssh_6.6.1 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: kex: ecdh-sha2-nistp256 need=20 dh_need=20 debug1: kex: ecdh-sha2-nistp256 need=20 dh_need=20 debug1: sending ssh2_msg_kex_ecdh_init debug1: expecting ssh2_msg_kex_ecdh_reply debug1: server host key: rsa 56:27:ac:a5:36:28:2d:36:23:1b:56:4d:eb:df:a6:48 debug1: host 'github.com' known , matches rsa host key. debug1: found key in /home/centos/.ssh/known_hosts:1 warning: permanently added rsa host key ip address '192.30.252.131' list of known hosts. 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 server debug1: ssh2_msg_service_request sent debug1: ssh2_msg_service_accept received debug1: authentications can continue: publickey debug1: next authentication method: publickey debug1: offering rsa public key: /home/centos7/.ssh/id_rsa debug1: server accepts key: pkalg ssh-rsa blen 535 debug1: authentication succeeded (publickey). authenticated github.com ([192.30.252.131]:22). debug1: channel 0: new [client-session] debug1: entering interactive session. debug1: sending environment. debug1: sending env lang = en_us.utf-8 debug1: sending env lc_ctype = utf-8 hi tomkim! you've authenticated, github not provide shell access. debug1: client_input_channel_req: channel 0 rtype exit-status reply 0 debug1: channel 0: free: client-session, nchannels 1 transferred: sent 4128, received 2040 bytes, in 0.5 seconds bytes per second: sent 8000.8, received 3953.9 debug1: exit status 1 

as line above showed hi tomkim! you've authenticated, github not provide shell access. means unthenticated, why can't clone repo?

update: can clone in home directory, when try sudo did not work, happen in /var/www/html/ folder

$ sudo git clone git@github.privaterepo/repo.git cloning 'repo'... warning: permanently added rsa host key ip address '192.30.252.131' list of known hosts. permission denied (publickey). fatal: not read remote repository.

please make sure have correct access rights , repository exists.

$ git clone git@github.privaterepo/repo.git cloning 'repo'... remote: counting objects: 4741, done. remote: total 4741 (delta 0), reused 0 (delta 0), pack-reused 4741 receiving objects: 100% (4741/4741), 30.30 mib | 5.83 mib/s, done. resolving deltas: 100% (1451/1451), done. [centos@ip-172-31-12-124 ~]$ ll total 4 drwxrwxr-x. 12 centos centos 4096 jun 15 04:16 repo

i know can clone https, solve issue, can help?

the answer related user permission issue. need set correct folder permission current user.

for git sudo issue, answer can found in below link:

https://help.github.com/articles/error-permission-denied-publickey/#should-the-sudo-command-be-used-with-git

thanks chris looking question.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -