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

Github 多账号配置

时间:2019-02-15 22:34:05      阅读:219      评论:0      收藏:0      [点我收藏+]

标签:entity   rsa   地址   添加   key   公钥   别名   服务   ssh   

1. 不同账户,生成不同密钥
ssh-keygen -t rsa -f github1 -C "xxx@163.com"
ssh-keygen -t rsa -f github2 -C "xxx@163.com"

2. 把生成的公钥添加到github上,设置,ssh-key,new ssh。

3. 编辑~/.ssh/config文件添加如下内容:
  # 其中Host是主机别名,HostName是github服务器地址,User是GitHub服务器用户名,
  # IdentityFile是和GitHub服务器通信的ssh私钥,通过IdentityFile就可以区分出
  # 不同的账号。
  Host account1
  HostName github.com
  User git
  IdentityFile ~/.ssh/github1
  Host account2
  HostName github.com  
  User git
  IdentityFile ~/.ssh/github2
4. ssh-add 管理
  ssh-add github1
  ssh-add github2

5. git remote set-url origin account1:github账号/xxxx.git

Github 多账号配置

标签:entity   rsa   地址   添加   key   公钥   别名   服务   ssh   

原文地址:https://www.cnblogs.com/hanwen1014/p/10386209.html

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