EGit和多个“用户”在同一台机器上 [英] EGit and multiple "users" on same machine
问题描述
user.name
和 user.email
。例如,我可能想要在GitHub上托管的一些名为 fizz
的项目上工作,也可以在另一个名为 buzz
有自己的私人托管,集中的git服务器/ repo。 对于 fizz
项目,我想使用 myname@example.com
作为我的电子邮件,所以当我将更改推送到主分支时,其他协作者将其视为我的用户名/电子邮件。 / p>
但是对于 buzz
项目,我想使用 myname@someotherdomain.example .com
,所以当我将更改推送到其主人时,协作者在 buzz
项目中,以便作为我的电子邮件。
除非我错了,EGit似乎只允许我配置1 user.name
和 user.email
。我该怎么办?感谢提前!
Git配置存储在以下文件中,当查找配置时,将在以下尝试订单(请参阅 git config ):
- 本地:
.git / config
在当前存储库中 - 全局:<$ c $系统配置目录中的用户主目录
- 系统:
gitconfig
中的.gitconfig/ etc
在Linux上)
所以要配置 user.email
对于特定的存储库,请执行以下操作:
- 从存储库的属性中打开 >
- 输入
user.email
作为键和所需值 - 单击确定
Th e库配置也可以从首选项>团队> Git>配置>存储库设置更改。
请注意,在Git中, user.name
应该是一个真正的全名,如 Jane Doe
。
I'd like to work with multiple git-based open source projects from the same machine. For each project, I'd like to associate a differnet user.name
and user.email
as appropriate. For instance, I might want to work on some project called fizz
that is hosted on GitHub, and also work on another project called buzz
that has its own privately-hosted, centralized git server/repo.
For the fizz
project, I'd like to use myname@example.com
as my email, so that when I push changes to the master branch, other collaborators see that as my username/email.
But for the buzz
project, I'd like to user myname@someotherdomain.example.com
, so that when I push changes to its master, collaborators on the buzz
project so that as my email.
Unless I'm mistaken, EGit seems to only allow me to configure 1 user.name
and user.email
. How can I get around this? Thanks in advance!
Git configuration is stored in the following files, and when looking up configuration, it is tried in the following order (see git config):
- Local:
.git/config
in the current repository - Global:
.gitconfig
in the user's home directory - System:
gitconfig
in the system configuration directory (e.g./etc
on Linux)
So to configure user.email
differently for a specific repository, do the following:
- Open the properties of a repository from the Git Repositories view
- In the Configuration tab, click on Add Entry...
- Enter
user.email
as the key and the desired value - Click OK
The repository configuration can also be changed from the preferences > Team > Git > Configuration > Repository Settings.
Note that in Git, user.name
should be a real full name such as Jane Doe
.
这篇关于EGit和多个“用户”在同一台机器上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!