码迷,mamicode.com
首页 > 其他好文 > 详细

Git-ssh登录github

时间:2017-02-13 21:49:59      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:remote   class   host   sap   logs   hub   efault   conf   nts   

  1. 生成你的ssh-key
    1. $ ssh-keygen -t rsa -b 4096 -C  "SaphhireCastle@163.com"
    2. 默认目录为:/Users/you/id_rsa_email 多key好区分
    3. 输入passphrase,统一123456
  2. 将key加入agents中
    1. $ ssh-add ~/.ssh/id_rsa_SapphireCastle
    2. 查看现有key: $ ssh-add -l
    3. 删除key: $ssh-add -D
    4. 查询ssh-agents版本:ssh-add -v
    5. 打开/关闭ssh:$ sudo systemsetup  -setremotelogin on/off
  3. github服务器加入公匙
    1. 复制本地公匙 $ cat  ~/.ssh/id_rsa_SapphireCastle.pub
    2. GITHUB -> Settings -> SSH and GPG keys -> New SSH key
  4. 验证是否连通
    1. $ ssh -T git@github.com   此处为config中配置的host

 

 

 

多用户使用ssh登录

#default github user(SapphireCastle | SapphireCastle@163.com)

Host github.com

  HostName github.com

  PreferredAuthentications publickey

  IdentityFile ~/.ssh/id_rsa_sapphirecastle

 

#other github user(TigerEatGrass | lijianzhi01@gmail.com)

Host teg.github.com

  HostName github.com

  PreferredAuthentications publickey

  IdentityFile ~/.ssh/id_rsa_lijianzhi01

 

 

Git-ssh登录github

标签:remote   class   host   sap   logs   hub   efault   conf   nts   

原文地址:http://www.cnblogs.com/SapphireCastle/p/6395192.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!