Github appear Permission denied (public key) to access

A problem was found:

  Appears Permission denied (public key) when using the git clone command.

Second problem:

  1, the first attempt to re-add key previously generated, adding several times, still does not work.

  2, use the command ssh -v [email protected] test, the last few lines as follows:   

    debug1: Authentications that can continue: publickey
    debug1: Next authentication method: publickey
    debug1: Trying private key: /home/gr/.ssh/id_rsa
    debug1: Trying private key: /home/gr/.ssh/id_dsa
    debug1: Trying private key: /home/gr/.ssh/id_ecdsa
    debug1: No more authentication methods to try.
    Permission denied (publickey).

  3. Analysis: try the three private key, but without success, finally leading to Permission denied.

  4, to see my key, ls ~ / .ssh /:

    bajie  bajie.pub  known_hosts    

  5, I found my id_rsa file command bajie, so there is no use of it. At the same time can use the following command to view the list of keys:

    ssh-add -l

  6, the above command key list is empty, so I want to add the key, use the command:

    gr@grpc:~/workspace/git/home$ ssh-add ~/.ssh/bajie

    Enter passphrase for /home/gr/.ssh/bajie:
    Identity added: /home/gr/.ssh/bajie (/home/gr/.ssh/bajie)

  7, to see again, as follows, successfully added:

    gr@grpc:~/workspace/git/home$ ssh-add -l

    2048 63: 5: d8 6c: A0: 0C: A8: 9c: 26: D8: F8: 95: to 29: 04: /home/gr/.ssh/bajie eb (RSA)

  8, and then test the connection using ssh -v [email protected], verification can be seen by:

    debug1: Authentications that can continue: publickey
    debug1: Next authentication method: publickey
    debug1: Offering RSA public key: /home/gr/.ssh/bajie
    debug1: Server accepts key: pkalg ssh-rsa blen 279
    debug1: Authentication succeeded (publickey).
    Authenticated to github.com ([192.30.252.129]:22).

  9, finally git clone success of the project.

 

  Welcome to my personal home page: www.forgerui.tk

Reproduced in: https: //my.oschina.net/grnick/blog/201155

Guess you like

Origin blog.csdn.net/weixin_34221276/article/details/91777848