{"thread":{"id":"64219","subject":"Feature request: partial URL matching for credential config","startedAt":"2025-09-27T18:49:34Z","lastAt":"2025-09-30T19:00:17Z","messageCount":4,"participants":["M Hickford","brian m. carlson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"527494","messageId":"CAGJzqsn7BbaVckJ17XhsDHLtmS3OZPBG=oniwe+FRjhEwGc+Eg@mail.gmail.com","threadId":"64219","inReplyTo":null,"subject":"Feature request: partial URL matching for credential config","fromName":"M Hickford","fromEmail":"mirth.hickford@gmail.com","sentAt":"2025-09-27T18:48:46Z","receivedAt":"2025-09-27T18:49:34Z","isPatch":false,"sender":{"key":"mirth.hickford@gmail.com","avatar":"https://avatars.githubusercontent.com/u/105314?v=4"},"body":"Hi. A git-credential-oauth user would like to define separate\ncredential config for two URLs prefixes of the same host (eg.\nhttps://example.com/org1/* and http://example.com/org2/*)\nhttps://github.com/hickford/git-credential-oauth/issues/83\n\nI don't believe this is currently possible\nhttps://git-scm.com/docs/gitcredentials\n\n> 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.\n\nAny thoughts on adding support for URL prefix matching?\n\nExample syntax could be credential.https://example.com/org1/*.key\n(explicit wildcard) or credential.https://example.com/org1/.key\n(implicit wildcard)\n\nPeace\n-M\n"},{"id":"527509","messageId":"CAGJzqs=8QHB2UjECVpEB2_R85dG1oHg2F2ewDRVpun8XqbboKQ@mail.gmail.com","threadId":"64219","inReplyTo":"CAGJzqsn7BbaVckJ17XhsDHLtmS3OZPBG=oniwe+FRjhEwGc+Eg@mail.gmail.com","subject":"Re: Feature request: partial URL matching for credential config","fromName":"M Hickford","fromEmail":"mirth.hickford@gmail.com","sentAt":"2025-09-28T14:13:55Z","receivedAt":"2025-09-28T14:14:46Z","isPatch":false,"sender":{"key":"mirth.hickford@gmail.com","avatar":"https://avatars.githubusercontent.com/u/105314?v=4"},"body":"On Sat, 27 Sept 2025 at 19:48, M Hickford <mirth.hickford@gmail.com> wrote:\n>\n> Hi. A git-credential-oauth user would like to define separate\n> credential config for two URLs prefixes of the same host (eg.\n> https://example.com/org1/* and http://example.com/org2/*)\n> https://github.com/hickford/git-credential-oauth/issues/83\n>\n> I don't believe this is currently possible\n> https://git-scm.com/docs/gitcredentials\n>\n> > 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.\n>\n> Any thoughts on adding support for URL prefix matching?\n>\n> Example syntax could be credential.https://example.com/org1/*.key\n> (explicit wildcard) or credential.https://example.com/org1/.key\n> (implicit wildcard)\n\nHere's a simpler example without OAuth -- configuring a personal\nusername for https://git.example.com and an enterprise username for\nURLs beginning  https://git.example.com/syscorp/\n\ncredential.https://git.example.com.username=tim\ncredential.https://git.example.com/syscorp/.username=timothy.smith\n"},{"id":"527638","messageId":"aNvxVOUyijGaJfsr@fruit.crustytoothpaste.net","threadId":"64219","inReplyTo":"CAGJzqsn7BbaVckJ17XhsDHLtmS3OZPBG=oniwe+FRjhEwGc+Eg@mail.gmail.com","subject":"Re: Feature request: partial URL matching for credential config","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2025-09-30T15:03:48Z","receivedAt":"2025-09-30T15:03:50Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2025-09-27 at 18:48:46, M Hickford wrote:\n> Any thoughts on adding support for URL prefix matching?\n> \n> Example syntax could be credential.https://example.com/org1/*.key\n> (explicit wildcard) or credential.https://example.com/org1/.key\n> (implicit wildcard)\n\nI think I may have added support for this (using the urlmatch patterns)\nbut didn't document it[0].  I see some tests for it in t0300.  Have you\ntried it?\n\nRegardless, I believe it's a useful feature that we should have.\n\nIf, perchance, I did add it and it's still around, would you be willing\nto write some documentation for it?\n\n[0] I believe Dscho graciously helped fix a few bugs in my changes,\nwhich I appreciate.\n-- \nbrian m. carlson (they/them)\nToronto, Ontario, CA\n"},{"id":"527648","messageId":"CAGJzqskzfpyobvV1abTr9qUgGWLuhfTE4FdbgKJy4HZgfO-oLw@mail.gmail.com","threadId":"64219","inReplyTo":"aNvxVOUyijGaJfsr@fruit.crustytoothpaste.net","subject":"Re: Feature request: partial URL matching for credential config","fromName":"M Hickford","fromEmail":"mirth.hickford@gmail.com","sentAt":"2025-09-30T18:59:00Z","receivedAt":"2025-09-30T19:00:17Z","isPatch":false,"sender":{"key":"mirth.hickford@gmail.com","avatar":"https://avatars.githubusercontent.com/u/105314?v=4"},"body":"On Tue, 30 Sept 2025 at 16:03, brian m. carlson\n<sandals@crustytoothpaste.net> wrote:\n>\n> On 2025-09-27 at 18:48:46, M Hickford wrote:\n> > Any thoughts on adding support for URL prefix matching?\n> >\n> > Example syntax could be credential.https://example.com/org1/*.key\n> > (explicit wildcard) or credential.https://example.com/org1/.key\n> > (implicit wildcard)\n>\n> I think I may have added support for this (using the urlmatch patterns)\n> but didn't document it[0].  I see some tests for it in t0300.  Have you\n> tried it?\n\nThanks Brian for your reply. You're right, it already works as desired:\n\n     $ git -c credential.https://example.com/org.username=bingo config\nget --url=https://example.com/org/repo.git credential.username\n     bingo\n\nIt has to be a path prefix, not just a string prefix, which is nice:\n\n     $ git -c credential.https://example.com/org.username=bingo config\nget --url=https://example.com/organ/repo.git credential.username\n\n>\n> Regardless, I believe it's a useful feature that we should have.\n>\n> If, perchance, I did add it and it's still around, would you be willing\n> to write some documentation for it?\n\nI shall send a patch with documentation and expanded tests.\n\n>\n> [0] I believe Dscho graciously helped fix a few bugs in my changes,\n> which I appreciate.\n> --\n> brian m. carlson (they/them)\n> Toronto, Ontario, CA\n"}]}