$ ssh-keygen -t rsa -C "lisi@yyy.com" Generating public/private rsa key pair. Enter file in which to save the key (/Users/lisi/.ssh/id_rsa): id_rsa_lisi ... $ ssh-keygen -t rsa -C "zhangsan@xxx.com" Generating public/private rsa key pair. Enter file in which to save the key (/Users/lisi/.ssh/id_rsa): id_rsa_zhangsan ...
将公钥添加到对应的 github 账号
略
添加配置文件管理私钥
在.ssh目录下新建config文件,添加如下配置:
1 2 3 4 5 6 7 8 9 10
### Github Host lisi HostName github.com User lisi IdentityFile ~/.ssh/id_rsa_lisi Host zhangsan HostName github.com User zhangsan IdentityFile ~/.ssh/id_rsa_zhangsan
$ ssh -T git@github.com Warning: Permanently added the RSA host key for IP address '13.250.177.223' to the list of known hosts. Hi lisi! You've successfully authenticated, but GitHub does not provide shell access.