1
| ssh-keygen -t rsa -C "YourMail@github.com" -f ~/.ssh/github_rsa
|
添加到私钥列表
1 2
| ssh-add ~/.ssh/id_rsa ssh-add ~/.ssh/github_rsa
|
查看私钥列表
1 2 3 4 5
| ssh-add -l
ssh-add -D
|
添加配置
添加配置内容
1 2 3 4
| Host github.com HostName github.com PreferredAuthentications publickey IdentityFile ~/.ssh/github_rsa
|
添加github_rsa.pub内容到github的SSH KEY列表
1
| cat ~/.ssh/github_rsa.pub
|
测试
1 2 3 4
| ⇒ ssh -T git@github.com
Hi welsonla! You've successfully authenticated, but GitHub does not provide shell access.
|
参考资料
https://my.oschina.net/stefanzhlg/blog/529403
http://riny.net/2014/git-ssh-key/