- 使用git pull 或者 push的时候报错
- Permission denied (publickey).
- fatal: Could not read from remote repository.
- Please make sure you have the correct access rights
- and the repository exists.
- 出现这个问题是因为,没有在github账号添加SSH key
在本地创建密匙 1 
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23xq@xq-family:~/workspace/hexo$ ssh-keygen -t rsa -C "xxxx" //xxxx是你的用户名 
 Generating public/private rsa key pair.
 Enter file in which to save the key (/home/xq/.ssh/id_rsa): /home/xq/.ssh/id_rsa_2 //指定生成的位置以及名称
 Enter passphrase (empty for no passphrase):
 Enter same passphrase again:
 Your identification has been saved in /home/xq/.ssh/id_rsa_2.
 Your public key has been saved in /home/xq/.ssh/id_rsa_2.pub.
 The key fingerprint is:
 SHA256:Mzo1k/Sr4sRhR/EEH4pnANGOoCDR4PKP4uJ5nHCEp6g [email protected]
 The key's randomart image is:
 +---[RSA 2048]----+
 |o+ o+. o.o |
 |+ o .o * . |
 |+o.. o. * o |
 |oo o. .= o |
 |. = o S . |
 |.o + o = = . |
 |o = o = . |
 |E..+ ... . |
 |o+. .... |
 +----[SHA256]-----+
 xq@xq-family:~/workspace/hexo$ ssh-add /home/xq/.ssh/id_rsa_2 //添加密匙到ssh
 Identity added: /home/xq/.ssh/id_rsa_2 (/home/xq/.ssh/id_rsa_2)
//使用cat命令查看/home/xq/.ssh/id_rsa_2.pub  然后把里面的内容复制到git 公匙里面1
2
3
4
5
6
7测试:ssh [email protected]
The authenticity of host ‘github.com (207.97.227.239)’ can’t be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘github.com,207.97.227.239′ (RSA) to the list of known hosts.
ERROR: Hi tekkub! You’ve successfully authenticated, but GitHub does not provide shell access
Connection to github.com closed.
