是否可以为不同的项目使用不同的Git配置? [英] Is it possible to have different Git configuration for different projects?
问题描述
.gitconfig
通常存储在user.home
目录中.
我使用不同的身份为A公司和B公司(主要是名称/电子邮件)从事其他项目.我该如何使用两种不同的Git配置,以免签入时使用名称/电子邮件?
I use a different identity to work on projects for Company A and something else for Company B (primarily the name / email). How can I have two different Git configurations so that my check-ins don't go with the name / email?
推荐答案
存储库特定克隆中的.git/config
文件是该克隆的本地文件.在那里放置的任何设置只会影响该特定项目的操作.
The .git/config
file in a particular clone of a repository is local to that clone. Any settings placed there will only affect actions for that particular project.
(默认情况下,git config
会修改.git/config
,而不是~/.gitconfig
-仅使用--global
会修改后者).
(By default, git config
modifies .git/config
, not ~/.gitconfig
- only with --global
does it modify the latter.)
这篇关于是否可以为不同的项目使用不同的Git配置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!