Github需要publickey的解决办法



  • tvro@instance-3:~$ git clone git@github.com:bitpay/bitcore.git
    Cloning into 'bitcore'...
    git@github.com: Permission denied (publickey).
    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights
    and the repository exists.
    提示不能Clone,需要publickey

    1,cd ~/.ssh
    2,在.ssh文件夹中,应该有这两个文件:id_rsa和id_rsa.pub,3,
    3,如果没有上述两个文件那么tvro@instance-3:~$ssh-keygen -t rsa -C "your_email@example.com",创建id_rsa和id_rsa.pub文件
    4,vim id_rsa.pub
    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGg3JgoL开头的全部复制
    5,打开github.com-Settings-SSH and GPG keys-New SSH key,粘贴到里面ADD SSH key。
    6,返回到Xshell客户端再来试试看吧!
    tvro@instance-3:~$ git clone git@github.com:bitpay/bitcore.git
    Cloning into 'bitcore'...
    Warning: Permanently added the RSA host key for IP address '192.30.253.112' to the list of known hosts.
    remote: Enumerating objects: 164, done.
    remote: Counting objects: 100% (164/164), done.
    remote: Compressing objects: 100% (97/97), done.
    remote: Total 70440 (delta 88), reused 97 (delta 66), pack-reused 70276
    Receiving objects: 100% (70440/70440), 65.77 MiB | 1.60 MiB/s, done.
    Resolving deltas: 100% (46819/46819), done.