是否有可能为不同的项目有不同的git配置 [英] Is it possible to have different git config for different projects

查看:131
本文介绍了是否有可能为不同的项目有不同的git配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.gitconfig 通常存储在 user.home 目录中。



我使用不同的身份来处理公司A的项目和公司B的其他项目(主要是名称/电子邮件)。我怎样才能拥有2种不同的git配置,这样我的签入就不会与名称/电子邮件一起出现?

存储库的特定克隆中的 .git / config 文件对于该克隆来说是本地的。



(默认情况下, git config 修改 .git / config ,而不是〜/ .gitconfig - 仅限于 - global 是否修改后者。)


.gitconfig is usually stored in the user.home directory.

I use a different identity to work on projects for CompanyA and something else for CompanyB (primarily the name / email). How can I have 2 different git configurations so that my check-ins don't go with the name / email?

解决方案

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.

(By default, git config modifies .git/config, not ~/.gitconfig - only with --global does it modify the latter.)

这篇关于是否有可能为不同的项目有不同的git配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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