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

Multiple --global config workspaces?

From
EHElsie Hupp <git@elsiehupp.com>
Date
Oct 11, 2022, 03:06 UTC
Message-ID
<C4E3A512-2E2C-4EA5-9F2E-3662BCF0F165@elsiehupp.com>
Hi Git Mailing List,
The way I personally use Git has a slight inconvenience: as far as I can tell, there is no way to define multiple git config --global workspaces in a single Unix account. 
I structure my cloned repositories based on the remote host, e.g.:

~/Repositories/github/cloned-repository-name ~/Repositories/gitlab/other-cloned-repository-name

…and I sign my git commits for each remote host using an email address and signing key specific to that host.
I imagine many people have similar arrangements for the purpose of separating, say, work projects from personal projects.
Before I started using this workspace arrangement, I was able to do the following:

$ git config --global user.name "Elsie Hupp" $ git config --global user.email "elsiehupp@example.com"

However, now that I use different signing identities for different remote hosts, I have to set up my Git identity every single time I clone a repository, and this repetitiveness is the slight inconvenience I refer to above.
What might possibly help in this situation could be if I could have the global ~/.gitconfig somehow delegate to separate .gitconfig files in each of the workspace folders I have set up, e.g.:

~/Repositories/github/.gitconfig ~/Repositories/gitlab/.gitconfig

…and then have git config --global in, e.g., ~/Repositories/github/cloned-repository-name apply to all cloned repositories in ~/Repositories/github but not to cloned repositories in ~/Repositories/gitlab.
(Obviously there are other ways this could be implemented, but this is the one that immediately came to mind.)
How feasible would it be to implement multiple --global config workspaces with functionality along these lines? And what other considerations and issues might there be with doing so?
Anyway, thank you for your time and attention.

Sincerely, Elsie Hupp

Next: Junio C Hamano
Message 1 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.