Étape j'avais fait: https://help.github.com/articles/generating-ssh-keys/ suis exactement.
$ eval "$(ssh-agent -s)"
Agent pid 31944
$ ssh-add
Enter passphrase for /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)
Cependant, quand je cours
$ git clone [email protected]:privateRepo/repo.git
Cloning into 'repo'...
The authenticity of Host 'github.com (192.30.252.130)' can't be established.
RSA key fingerprint is 56:27:ac:a5:36:28:2d:36:23:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.252.130' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Ci-dessous la sortie que je lance
$ ssh -Tv [email protected]
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 for *github.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 56: Applying options for *
debug1: Connecting to 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 for 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' is known and matches the RSA Host key.
debug1: Found key in /home/centos/.ssh/known_hosts:1
Warning: Permanently added the RSA Host key for IP address '192.30.252.131' to the 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 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/centos7/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 535
debug1: Authentication succeeded (publickey).
Authenticated to 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 successfully authenticated, but GitHub does 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
Comme la ligne ci-dessus l'a montré, Hi tomkim! You've successfully authenticated, but GitHub does not provide Shell access.
, ce qui signifie que je ne suis déjà pas impliqué, mais pourquoi je ne peux pas cloner mon référentiel?
Update: Je peux cloner mon répertoire personnel, mais lorsque j'essaie avec Sudo, cela ne fonctionne pas, cela se produit dans mon dossier/var/www/html /.
$ Sudo git clone [email protected]/repo.gitCloning dans 'repo' ... Avertissement: ajout permanent de la clé d'hôte RSA pour l'adresse IP '192.30.252.131' à la liste des hôtes connus. Autorisation refusée (publickey) . Fatal: Impossible de lire à partir du référentiel distant.
Assurez-vous que vous disposez des droits d'accès appropriés .__ et que le référentiel existe.
$ git clone [email protected]/repo.gitCloning en 'repo' ....__ remote: Comptage d'objets: 4741, terminé . remote: Total 4741 (delta 0), réutilisé 0 ( delta 0), paquet réutilisé 4741 Réception d'objets: 100% (4741/4741), 30,30 MiB | 5,83 Mio/s, terminé le ........ Résolution des deltas: 100% (1451/1451), terminé le ........ [centos @ ip-172-31-12-124 ~] $ ll. drwxrwxr-x. 12 centos centos 4096 15 juin 04:16 repo
Je sais que je peux cloner avec HTTPS, mais j'aimerais résoudre ce problème, tout le monde peut-il aider?
La réponse est un problème d'autorisation d'utilisateur associé. Je dois définir la permission de dossier correcte pour l'utilisateur actuel.
Pour la question git Sudo, la réponse se trouve dans le lien ci-dessous:
Merci Chris d'avoir examiné cette question.
use this https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/
puis obtenez votre clé générée (commencez par ssh-rsa ou un autre type) allez sur votre panneau d'utilisateur git -> Clés SSH & GPG -> Nouvelle clé SSH -> collez votre clé (remplissez le titre par n'importe lequel) puis appuyez sur Ajouter Clé SSH
Réparera.
bonne chance.