Re: Multiple --global config workspaces?
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 11, 2022, 05:50 UTC
- Message-ID
- <xmqqwn96x61t.fsf@gitster.g>
- In-Reply-To
- <C4E3A512-2E2C-4EA5-9F2E-3662BCF0F165@elsiehupp.com>
Elsie Hupp <git@elsiehupp.com> writes:
> I structure my cloned repositories based on the remote host, e.g.: > > ~/Repositories/github/cloned-repository-name > ~/Repositories/gitlab/other-cloned-repository-name
The above is by definition not "global" (aka "per user").
"--global" is for things that are of your personal preference, not "when I am working on this project, these settings apply" (which is suitable for "per repository").
What you want is a way to say "when I am working on these projects, these settings apply".
One way to do this would be to have
[includeIf "gitdir:~/Repositories/github/"] path = $HOME/.githubconfig [includeIf "gitdir:~/Repositories/gitlab/"] path = $HOME/.gitlabconfig
in $HOME/.gitconfig and then write in these two extra files that are conditionally included whatever settings you want to use for any and all repositories that come from GitHub or GitLab.
$ git help config
and look for Conditional includes, perhaps?