1.查看是否已经有了ssh密钥:
cat ~/.ssh/github
cd ~/.ssh 查看密钥文件
2.没有密钥文件,则生成
ssh-keygen -t rsa -C "xxx@yyy.com" -f ~/.ssh/github
3.查看密钥文件
ls ~/.ssh/
4.查看公钥
cat ~/.ssh/github 把输出的值放到github: https://github.com/settings/ssh
5.添加到SSH
ssh-add ~/.ssh/github
6.检查一下
vi ~/.ssh/config
host github
user shizuwei
hostname github.com
port 22
identityfile ~/.ssh/github
7.连接一下试试
$ ssh git@github.com
PTY allocation request failed on channel 0
Hi shizuwei! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.