创建单个ssh 密钥
ssh-keygen -t rsa -C "youremail@example.com"
cd ~/.ssh
ls # 浏览下目录下所有的rsa
cat ~/.ssh/xxx-rsa.pub
创建管理多个ssh 密钥的时候
ssh-keygen -t rsa -C "youremail@example.com" -f ~/.ssh/xxx-rsa
ssh-keygen -t rsa -C "youremail@example.com" -f ~/.ssh/xxx-rsa
ssh-keygen -t rsa -C "youremail@example.com" -f ~/.ssh/xxx-rsa
...
ssh-add ~/.ssh/xxx-rsa
ssh-add ~/.ssh/xxx-rsa
ssh-add ~/.ssh/xxx-rsa
....
-
第二步,配置configer(~/.ssh),如果没有的话创建
# dt-rsa (youremail@example.com)
Host gitee.com
User youremail@example.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/xxx-rsa
# gitee-rsa (youremail@example.com)
Host gitee.com
# HostName https://gitee.com
User youremail@example.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/xxx-rsa
....
https://gitee.com
网友评论