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

Re: feature request: user email config per domain

From
Jeff King <peff@peff.net>
Date
Feb 23, 2017, 00:42 UTC
Message-ID
<20170223004235.lsfyboofmqg6btt7@sigill.intra.peff.net>
In-Reply-To
<CAN0Skmmjd5Y0uWz_WC69mAStucZ6nR0mjdp4-ODJz2UnTaB-eQ@mail.gmail.com>
On Wed, Feb 22, 2017 at 06:42:02PM +0530, Tushar Kapila wrote:
Show 12 quoted lines
> Feature request :  can we have a config for email per repo domain ?
> Something like:
> 
> git config --global domain.user.email tgkprog@test.xyz.com
> testing.abc.doman:8080
> 
> git config --global domain.user.email tgkprog@xyz.com abc.doman:80
> 
> git config --global domain.user.email tgkprog@search.com github.com
> 
> So when remote URL has github.com push as tgkprog@search.com but for
> testing.abc.doman:8080 use tgkprog@test.xyz.com ?

The idea of "the domain for this repo" doesn't really match Git's distributed model. A repo may have no remotes at all, or multiple remotes with different domains (or even remotes which do not have a domain associated with them, like local files, or remote helpers which obscure the domain name).

It sounds like you're assuming that the domain would come from looking at remote.origin.url. Which I agree would work in the common case of "git clone https://example.com", but I'm not comfortable with the number of corner cases the feature has.

I'd much rather see something based on the working tree path, like Duy's conditional config includes. Then you write something in your ~/.gitconfig like:

  [include "gitdir:/home/peff/work/"]
  path = .gitconfig-work
  [include "gitdir:/home/peff/play/"]
  path = .gitconfig-play
and set user.email as appropriate in each.

You may also set user.useConfigOnly in your ~/.gitconfig. Then you'd have to set user.email in each individual repository, but at least Git would complain and remind you when you forget to do so, rather than silently using the wrong email.

-Peff
Previous: Andrew ArdillNext: Igor Djordjevic BugA
Message 4 of 6 in “feature request: user email config per domain”
  1. Tushar KapilaFeb 22, 2017
  2. Pranit BauvaFeb 22, 2017
  3. Andrew ArdillFeb 22, 2017
  4. Jeff KingFeb 23, 2017
  5. Igor Djordjevic BugAFeb 23, 2017
  6. Fwd: Re: feature request: user email config per domainIgor Djordjevic, Feb 23, 2017

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.