From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Nicolas Mailhot <nicolas.mailhot@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [RFE] Please add name and email to git credentials
Date: Thu, 01 Nov 2018 14:15:00 +0100 [thread overview]
Message-ID: <87wopxj5wr.fsf@evledraar.gmail.com> (raw)
In-Reply-To: <6f3d8c49e1d44ab20d4169e5254364cba707f1af.camel@laposte.net>
On Thu, Nov 01 2018, Nicolas Mailhot wrote:
> Le jeudi 01 novembre 2018 à 12:22 +0100, Ævar Arnfjörð Bjarmason a
> écrit :
>>
>> Where would we get an E-Mail to lookup to pass to the helper? Are you
>> just asking that the helper git the result of $(git config user.name
>> &&
>> git config user.email)? If so why can't it just look this up itself?
>
>
> So, just in case it was not clear enough, allow things in .gitconfig
> like
>
> [credential "https://pkgs.fedoraproject.org/"]
> username = doe4ever
> name = John Doe
> email = doe4ever@fedoraproject.org
> [credential "https://gitlab.corp.com/"]
> username = jdoe56874
> name = John Doe, Snr Engineer
> email = john.doe@corp.com
>
> Instead of just
>
> [user]
> name = John Doe
> email = john.doe@corp.com
> [credential "https://pkgs.fedoraproject.org/"]
> username = doe4ever
> [credential "https://gitlab.corp.com/"]
> username = jdoe56874
>
> and drat, I've commited to XXX with the wrong name/email again
Aaaah! So really you just want to set user.{name,email} if you match a
given URL in the project, and this per-se has nothing to do with
credentials..
Yeah that's a fair request. Although I think tying that up with
credential.* doesn't make sense because we'd:
1) Need yet another place (config, env vars, now this...) to search for
what we're putting in the commit object.
2) Users want to configure this for e.g. different URLs even though
they don't need different credentials for the two.
I'm too lazy to dig up the thread, but there's been a discussion before
of extending the IncludeIf syntax to support more things that "gitdir",
e.g. matching on the remote URL.
So then you'd do:
[credential "https://pkgs.fedoraproject.org/"]
username = doe4ever
[IncludeIf "remote:https://pkgs.fedoraproject.org/*"]
path ~/.gitconfig.d/fedoraproject.config
But now what you need to do is clone all the projects in
e.g. ~/git/fedoraproject/* and do:
[credential "https://pkgs.fedoraproject.org/"]
username = doe4ever
[IncludeIf "gitdir:~/g/fedoraproject/*"]
path ~/.gitconfig.d/fedoraproject.config
next prev parent reply other threads:[~2018-11-01 13:15 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-01 9:59 [RFE] Please add name and email to git credentials Nicolas Mailhot
2018-11-01 11:22 ` Ævar Arnfjörð Bjarmason
2018-11-01 12:34 ` Nicolas Mailhot
2018-11-01 13:15 ` Ævar Arnfjörð Bjarmason [this message]
2018-11-01 14:13 ` Christian Couder
2018-11-01 14:32 ` Randall S. Becker
2018-11-01 14:42 ` Nicolas Mailhot
2018-11-02 8:27 ` Christian Couder
2018-11-02 8:57 ` Nicolas Mailhot
2018-11-02 16:51 ` Jeff King
2018-11-02 17:32 ` Nicolas Mailhot
2018-11-02 17:56 ` Jeff King
2018-11-01 11:32 ` Nicolas Mailhot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wopxj5wr.fsf@evledraar.gmail.com \
--to=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=nicolas.mailhot@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).