git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Feature request: partial URL matching for credential config
@ 2025-09-27 18:48 M Hickford
  2025-09-28 14:13 ` M Hickford
  2025-09-30 15:03 ` brian m. carlson
  0 siblings, 2 replies; 4+ messages in thread
From: M Hickford @ 2025-09-27 18:48 UTC (permalink / raw)
  To: Git Mailing List

Hi. A git-credential-oauth user would like to define separate
credential config for two URLs prefixes of the same host (eg.
https://example.com/org1/* and http://example.com/org2/*)
https://github.com/hickford/git-credential-oauth/issues/83

I don't believe this is currently possible
https://git-scm.com/docs/gitcredentials

> If the "pattern" URL does include a path component, then this too must match exactly: the context https://example.com/bar/baz.git will match a config entry for https://example.com/bar/baz.git (in addition to matching the config entry for https://example.com) but will not match a config entry for https://example.com/bar.

Any thoughts on adding support for URL prefix matching?

Example syntax could be credential.https://example.com/org1/*.key
(explicit wildcard) or credential.https://example.com/org1/.key
(implicit wildcard)

Peace
-M

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Feature request: partial URL matching for credential config
  2025-09-27 18:48 Feature request: partial URL matching for credential config M Hickford
@ 2025-09-28 14:13 ` M Hickford
  2025-09-30 15:03 ` brian m. carlson
  1 sibling, 0 replies; 4+ messages in thread
From: M Hickford @ 2025-09-28 14:13 UTC (permalink / raw)
  To: M Hickford; +Cc: Git Mailing List

On Sat, 27 Sept 2025 at 19:48, M Hickford <mirth.hickford@gmail.com> wrote:
>
> Hi. A git-credential-oauth user would like to define separate
> credential config for two URLs prefixes of the same host (eg.
> https://example.com/org1/* and http://example.com/org2/*)
> https://github.com/hickford/git-credential-oauth/issues/83
>
> I don't believe this is currently possible
> https://git-scm.com/docs/gitcredentials
>
> > If the "pattern" URL does include a path component, then this too must match exactly: the context https://example.com/bar/baz.git will match a config entry for https://example.com/bar/baz.git (in addition to matching the config entry for https://example.com) but will not match a config entry for https://example.com/bar.
>
> Any thoughts on adding support for URL prefix matching?
>
> Example syntax could be credential.https://example.com/org1/*.key
> (explicit wildcard) or credential.https://example.com/org1/.key
> (implicit wildcard)

Here's a simpler example without OAuth -- configuring a personal
username for https://git.example.com and an enterprise username for
URLs beginning  https://git.example.com/syscorp/

credential.https://git.example.com.username=tim
credential.https://git.example.com/syscorp/.username=timothy.smith

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Feature request: partial URL matching for credential config
  2025-09-27 18:48 Feature request: partial URL matching for credential config M Hickford
  2025-09-28 14:13 ` M Hickford
@ 2025-09-30 15:03 ` brian m. carlson
  2025-09-30 18:59   ` M Hickford
  1 sibling, 1 reply; 4+ messages in thread
From: brian m. carlson @ 2025-09-30 15:03 UTC (permalink / raw)
  To: M Hickford; +Cc: Git Mailing List

[-- Attachment #1: Type: text/plain, Size: 756 bytes --]

On 2025-09-27 at 18:48:46, M Hickford wrote:
> Any thoughts on adding support for URL prefix matching?
> 
> Example syntax could be credential.https://example.com/org1/*.key
> (explicit wildcard) or credential.https://example.com/org1/.key
> (implicit wildcard)

I think I may have added support for this (using the urlmatch patterns)
but didn't document it[0].  I see some tests for it in t0300.  Have you
tried it?

Regardless, I believe it's a useful feature that we should have.

If, perchance, I did add it and it's still around, would you be willing
to write some documentation for it?

[0] I believe Dscho graciously helped fix a few bugs in my changes,
which I appreciate.
-- 
brian m. carlson (they/them)
Toronto, Ontario, CA

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Feature request: partial URL matching for credential config
  2025-09-30 15:03 ` brian m. carlson
@ 2025-09-30 18:59   ` M Hickford
  0 siblings, 0 replies; 4+ messages in thread
From: M Hickford @ 2025-09-30 18:59 UTC (permalink / raw)
  To: brian m. carlson, M Hickford, Git Mailing List

On Tue, 30 Sept 2025 at 16:03, brian m. carlson
<sandals@crustytoothpaste.net> wrote:
>
> On 2025-09-27 at 18:48:46, M Hickford wrote:
> > Any thoughts on adding support for URL prefix matching?
> >
> > Example syntax could be credential.https://example.com/org1/*.key
> > (explicit wildcard) or credential.https://example.com/org1/.key
> > (implicit wildcard)
>
> I think I may have added support for this (using the urlmatch patterns)
> but didn't document it[0].  I see some tests for it in t0300.  Have you
> tried it?

Thanks Brian for your reply. You're right, it already works as desired:

     $ git -c credential.https://example.com/org.username=bingo config
get --url=https://example.com/org/repo.git credential.username
     bingo

It has to be a path prefix, not just a string prefix, which is nice:

     $ git -c credential.https://example.com/org.username=bingo config
get --url=https://example.com/organ/repo.git credential.username

>
> Regardless, I believe it's a useful feature that we should have.
>
> If, perchance, I did add it and it's still around, would you be willing
> to write some documentation for it?

I shall send a patch with documentation and expanded tests.

>
> [0] I believe Dscho graciously helped fix a few bugs in my changes,
> which I appreciate.
> --
> brian m. carlson (they/them)
> Toronto, Ontario, CA

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-09-30 19:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-27 18:48 Feature request: partial URL matching for credential config M Hickford
2025-09-28 14:13 ` M Hickford
2025-09-30 15:03 ` brian m. carlson
2025-09-30 18:59   ` M Hickford

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).