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

Re: [RFE] Please add name and email to git credentials

From
Jeff King <peff@peff.net>
Date
Nov 2, 2018, 16:51 UTC
Message-ID
<20181102165110.GA11212@sigill.intra.peff.net>
In-Reply-To
<1e3901b9a75a043d9c31d66d98410f3288a7c5be.camel@laposte.net>
On Fri, Nov 02, 2018 at 09:57:30AM +0100, Nicolas Mailhot wrote:
> Or are you arguing that having two separate mecanisms in git, to match
> config directives to repo urls, is some kind of improvement?

There are already are multiple mechanisms (e.g., http.* config). So that ship has sailed. ;)

> I didn't create or write or specify the way git credential matches repo
> urls. It already exists within git. If you have a problem with the
> matching logic git credential uses, why are you arguing with me instead
> of taking it up with the maintainers of this logic?

I did create the way git credential matches repo urls. And I do not think your proposal is a good idea. The credential system is about interacting with a remote URL, and creating a commit object is a local operation. That mismatch leaks through when you work with multiple remotes, since it is not clear which URL we would match against when the operation does not involve a remote at all.

If you want to have per-repo name/email for creating commits, right now your option is to have conditional config based on the local filesystem path.

Elsewhere in this thread[1] Ævar suggested having conditional config directives based on the presence of a remote. I'm a little hesitant there because it requires the config parsing to depend on the value of another key (introducing subtle timing dependencies). But aside from bizarre corner cases (e.g., including config for remote.* via a conditional include on the remote.* config), I think it would do what you want and would be generally useful.

That seems like a more fruitful direction to me.
-Peff
[1] https://public-inbox.org/git/87wopxj5wr.fsf@evledraar.gmail.com/
Previous: Nicolas MailhotNext: Nicolas Mailhot
Message 9 of 13 in “[RFE] Please add name and email to git credentials”
  1. Nicolas MailhotNov 1, 2018
  2. Ævar Arnfjörð BjarmasonNov 1, 2018
  3. Nicolas MailhotNov 1, 2018
  4. Ævar Arnfjörð BjarmasonNov 1, 2018
  5. Christian CouderNov 1, 2018
  6. Nicolas MailhotNov 1, 2018
  7. Christian CouderNov 2, 2018
  8. Nicolas MailhotNov 2, 2018
  9. Jeff KingNov 2, 2018
  10. Nicolas MailhotNov 2, 2018
  11. Jeff KingNov 2, 2018
  12. Randall S. BeckerNov 1, 2018
  13. Nicolas MailhotNov 1, 2018

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.