使用多个Git帐户 [英] Using multiple Git accounts

查看:70
本文介绍了使用多个Git帐户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在 Eclipse(egit)中拥有多个git帐户并选择每次使用哪个帐户?

Is it possible to have multiple git accounts in Eclipse(egit) and choose which one to use each time?

示例:
我目前有一个git帐户,具有用户名:workuser 电子邮件:workuser@company.com ,并且该帐户用于公司的存储库.

Example:
I currently have a git account, with username: workuser and email: workuser@company.com and this account is used for the company's repositories.

我想使用另一个帐户,该帐户将用于我的github存储库,并且与第一个帐户( workuser )没有任何关系,例如 username:githubuser email:anothermail@something.com

I want to use another account which will be used for my github repositories and will not have any relation to the first account (workuser), e.g. username:githubuser and email: anothermail@something.com

是否可以同时拥有两个帐户并选择每次使用哪个帐户来处理相关的存储库(不同的工作库和github)?

Is it possible to have both accounts and choose each time which account will be used in order to work on the related repositories(different for work and github) ?

推荐答案

我不了解egit,但默认情况下是 git config (不带-global )将值存储在特定于存储库的文件中,因此您唯一需要做的就是:

I don't know about egit, but by default, git config (without --global) stores values in repository-specific file, so the only thing you need to do is:

$ cd project-repo
$ git config user.name "<name>"
$ git config user.email "<mail>"

这篇关于使用多个Git帐户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆