- ssh-keygen -t rsa -C "[email protected]"
不要一直回车,指定密钥为 id_rsa_ljkj 默认为(id_rsa) 同理 创建其他密钥
- 打开ssh-agent
这里如果你用的github官方的bash,ssh-agent -s,
如果是其他的,比如msysgit,eval $(ssh-agent -s)
- 添加私钥
ssh-add ~/.ssh/id_rsa_ljkj
ssh-add ~/.ssh/id_rsa_github
- 创建 touch config 或修改vi config文件为如下格式
Host git.ling-ju.tech
HostName git.ling-ju.tech
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_github
User ljkj
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_github
User ling-ju