git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Multiple --global config workspaces?

From
Jeff King <peff@peff.net>
Date
Oct 11, 2022, 13:13 UTC
Message-ID
<Y0Vr/4IeA236nxzF@coredump.intra.peff.net>
In-Reply-To
<xmqqwn96x61t.fsf@gitster.g>
On Mon, Oct 10, 2022 at 10:50:22PM -0700, Junio C Hamano wrote:
Show 8 quoted lines
> 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.

I was about to write the same response. :) One small correction, though: we don't expand $HOME in include paths. You can use "~", but easier still is that non-absolute includes are relative to the including file. Relative paths in includes are relative to the including file. So you can just write ".githubconfig", etc, and we'll expect them adjacent to $HOME/.gitconfig (or the xdg path if you use that, I guess).

-Peff
Previous: Junio C HamanoNext: Elsie Hupp
Message 3 of 14 in “Multiple --global config workspaces?”
  1. Elsie HuppOct 11, 2022
  2. Junio C HamanoOct 11, 2022
  3. Jeff KingOct 11, 2022
  4. Elsie HuppOct 11, 2022
  5. Elsie HuppOct 11, 2022
  6. Jeff KingOct 14, 2022
  7. Matthias AßhauerOct 15, 2022
  8. Jeff KingOct 15, 2022
  9. Elsie HuppOct 18, 2022
  10. Jeff KingOct 18, 2022
  11. Elsie HuppOct 20, 2022
  12. Elsie HuppOct 20, 2022
  13. Philip OakleyOct 11, 2022
  14. RetoOct 11, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.