Git SSH

2018-10-27  本文已影响7人  StoneWing

创建单个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
....
# 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
上一篇 下一篇

猜你喜欢

热点阅读