$ cat config
# GitHub
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/github
# Gitee
Host gitee.com
HostName gitee.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/gitee
# Gitee
Host gitcode.com
HostName gitcode.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/gitcode
目录结构:
~/.ssh$ tree
.
├── config
├── gitcode
├── gitcode.pub
├── gitee
├── gitee.pub
├── github
├── github.pub
├── known_hosts
└── known_hosts.old
1 directory, 9 files
验证登陆:(***为你的账号名字)
$ ssh -T git@gitcode.com
remote: Welcome to GitCode, ***
$ ssh -T git@github.com
Hi ***! You've successfully authenticated, but GitHub does not provide shell access.
$ ssh -T git@gitee.com
Hi **! You've successfully authenticated, but GITEE.COM does not provide shell access.