一台机器多个git账号
来源:互联网 发布:youcam软件如何使用 编辑:程序博客网 时间:2024/06/11 21:47
http://www.ooso.net/archives/644
不知不觉就有了多个github帐户,平时为了方便都是采用ssh去操作git,所以这个时候问题就来了,在同一台机器上对多个github操作时,会因为ssh key只有一个而无法提交。所以我需要想办法配置多个ssh keys.
解决办法
放狗搜了一圈,有类似需求的大有人在。例如这里:Multiple GitHub Accounts & SSH Config
‘I’m having some trouble getting two different SSH keys/GitHub accounts to play well together. I have the following setup:
Repos accessible from one account using git@github.com:accountname Repos accessible from another account using git@github.com:anotheraccount
傻瓜操作步骤
生成新的ssh key
ssh-add这一步很重要,否则是前功尽弃
ssh-keygen -t rsa -C 'work@mail.com'ssh-add ~/.ssh/work_rsa
配置.ssh/config
我只需要在~/.ssh/config里新增一个Host的别名,将不同帐号的区分开来就可以了。
Host me.github.com HostName github.com PreferredAuthentications publickey IdentityFile ~/.ssh/me_rsaHost work.github.com HostName github.com PreferredAuthentications publickey IdentityFile ~/.ssh/work_rsa
配置git仓库
需要把git的配置更改过来,其中github.com更换为work.github.com,这样它会找到对应的key来登录。
git remote add origin git@work.github.com:work/test.git
- 一台机器多个git账号
- 同一台机器如何同时使用多个Git账号
- 同一台机器如何同时使用多个Git账号
- 在一台电脑上使用多个git账号
- windows一台电脑添加多个git账号
- git 在一台机器上配置多个账户
- windows下在一台电脑上配置多个git账号
- 同一台电脑运行多个git账号
- 在同一台电脑上配置多个git账号
- 一台机器启动多个TOMCAT
- 一台机器安装多个MySQL
- 如何在一台机器上配置多个git的rsa
- 如何在一台机器上配置多个git的rsa
- 如何在一台机器上配置多个Git的rsa
- 一台电脑使用多个GitHub账号配置方法
- 一台机器配置多个Git账户
- 一个ios账号,多台机器
- 6、安装git,一台电脑使用两个git账号
- 解析oracle的rownum
- hbase中Put源码分析
- JNI高级教程之数据类型转换
- S3C2440 存储控制器
- mkdir函数-linux
- 一台机器多个git账号
- 自定义控件中的ParseChildren
- SVM算法入门
- LeetCode - Swap Nodes in Pairs
- Java出现"此时不应有......."的错误
- C/C++记录程序运行时间的类
- Android学习:ListView的使用
- 统计SAP BW BEx Query使用情况
- hdu4619Warm up 2(二分匹配)