查看是否有文件id_rsa以及文件id_rsa.pub
cd ~/.ssh
ls
id_rsa id_rsa.pub known_hosts
生成ssh key
ssh-keygen -t rsa -C "<github account>"
一路回车
验证ssh key是否在github上存在
ssh -v github.com
No more authentication methods to try.
Permission denied (publickey).
不存在key
将SSH Key添加到ssh-agent
ssh-agent -s
将rsa key添加到ssh
ssh-add ~/.ssh/id_rsa
将rsa key配置到github account
进入github账号,Settings下,SSH and GPG keys->new SSH key
复制id_rsa.pub中的所有内容,然后Add SSH Key
最后验证添加的rsa key
ssh -T git@github.com