Git SSH

作者: StoneWing | 来源:发表于2018-10-27 15:36 被阅读7次

创建单个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

相关文章

网友评论

      本文标题:Git SSH

      本文链接:https://www.haomeiwen.com/subject/ahedtqtx.html