github 设置ssh keys (Permission denied)

#错误:Permission denied (publickey)

Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

#没有权限

 

A.查看SSH keys

$ ls -al ~/.ssh

#检查是否存在以 .pub 结尾的文件。如:id_rsa,id_rsa.pub

 

B.生成SSHKey

1. $ ssh-keygen -t rsa -b 4096 -C "your_email@example.com" #GitHub邮箱地址

2.回车(使用默认)
  Generating public/private rsa key pair.
  Enter a file in which to save the key (/home/you/.ssh/id_rsa): [Press enter]
  Enter passphrase (empty for no passphrase): [Type a passphrase]
  Enter same passphrase again: [Type passphrase again]

 

C.添加SSH Key 至 GitHub账户

1.进入GitHub

Settings ---> SSH and GPG keys --> New SSH key

 

2.查看id_rsa.pub

$ cat ~/.ssh/id_rsa.pub   #复制查看内容

 

 3.添加

Title:为新键添加一个描述性标签(自定义)

Key:复制查看id_rsa.pub的内容

 

4.点击 Add SSH Key

 

5.如果出现提示,请确认您的GitHub密码

 

posted @ 2018-07-07 18:33  shadow3  阅读(261)  评论(0)    收藏  举报