{"thread":{"id":"39168","subject":"Fwd: Can't override username of default credential context to have different username in custom context.","startedAt":"2015-04-27T16:19:31Z","lastAt":"2015-04-28T05:25:39Z","messageCount":3,"participants":["Vladislav Kostenko","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"260059","messageId":"CAK9djV0CqO4sXPMqKCnH3VZFQ4G=XFbNPRF-ZMXjNRLjqfcngw@mail.gmail.com","threadId":"39168","inReplyTo":null,"subject":"Fwd: Can't override username of default credential context to have different username in custom context.","fromName":"Vladislav Kostenko","fromEmail":"vkostenko@netlabsystems.com","sentAt":"2015-04-27T16:19:31Z","receivedAt":"2015-04-27T16:19:31Z","isPatch":false,"sender":{"key":"vkostenko@netlabsystems.com","avatar":null},"body":"Hi,\n\nHere is my scenario:\n\n1. First I set default username\ngit config --global credential.username myUsername\n\n2. Then I want to have different username for my other repository\ngit config --global\ncredential.https://myOtherRepository.visualstudio.com.username\nmyOtherUsername\n\n3. When I try to pull new changes, git asks for password of myUsername\nPassword for 'https://myUsername@myOtherRepository.visualstudio.com':\n\nBut I want to have:\nPassword for 'https://myOtherUsername@myOtherRepository.visualstudio.com':\n\nIs there any way to accomplish overriding?\n\nPS: I've found that if I change steps 1 and 2 I will get what I want.\nBut this is not a solution as it require to unset and set\ncredential.username after I add a new credential context. So the\nordering does matter and it looks for me like it shouldn't.\n\n-- \nBest regards, Vlad.\n"},{"id":"260097","messageId":"20150428052502.GF24580@peff.net","threadId":"39168","inReplyTo":"CAK9djV0CqO4sXPMqKCnH3VZFQ4G=XFbNPRF-ZMXjNRLjqfcngw@mail.gmail.com","subject":"Re: Fwd: Can't override username of default credential context to have different username in custom context.","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2015-04-28T05:25:02Z","receivedAt":"2015-04-28T05:25:02Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Apr 27, 2015 at 09:19:31PM +0500, Vladislav Kostenko wrote:\n\n> Here is my scenario:\n> \n> 1. First I set default username\n> git config --global credential.username myUsername\n> \n> 2. Then I want to have different username for my other repository\n> git config --global\n> credential.https://myOtherRepository.visualstudio.com.username\n> myOtherUsername\n> \n> 3. When I try to pull new changes, git asks for password of myUsername\n> Password for 'https://myUsername@myOtherRepository.visualstudio.com':\n> \n> But I want to have:\n> Password for 'https://myOtherUsername@myOtherRepository.visualstudio.com':\n> \n> Is there any way to accomplish overriding?\n\nOnly by changing the ordering in the config file, as you noticed.\n\nThe other http.* options will choose the most-specific match, but the\ncredential code predates that, and blindly goes in config order. Kyle\n(cc'd) added the urlmatch support for http.*, and might be able to say\nwhether it could be adapted for the credential code. If so, then I think\nit would need somebody to volunteer to work on it.\n\nThat would technically be a backwards-incompatible change to switch the\nlookup order at this point in time, but I'm somewhat of the opinion that\nin any case it matters, the new behavior would be a strict improvement.\n\n-Peff\n"},{"id":"260098","messageId":"20150428052539.GG24580@peff.net","threadId":"39168","inReplyTo":"20150428052502.GF24580@peff.net","subject":"Re: Fwd: Can't override username of default credential context to have different username in custom context.","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2015-04-28T05:25:39Z","receivedAt":"2015-04-28T05:25:39Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"[+cc Kyle, who I forgot on the initial send. Oops!]\n\nOn Tue, Apr 28, 2015 at 01:25:02AM -0400, Jeff King wrote:\n\n> On Mon, Apr 27, 2015 at 09:19:31PM +0500, Vladislav Kostenko wrote:\n> \n> > Here is my scenario:\n> > \n> > 1. First I set default username\n> > git config --global credential.username myUsername\n> > \n> > 2. Then I want to have different username for my other repository\n> > git config --global\n> > credential.https://myOtherRepository.visualstudio.com.username\n> > myOtherUsername\n> > \n> > 3. When I try to pull new changes, git asks for password of myUsername\n> > Password for 'https://myUsername@myOtherRepository.visualstudio.com':\n> > \n> > But I want to have:\n> > Password for 'https://myOtherUsername@myOtherRepository.visualstudio.com':\n> > \n> > Is there any way to accomplish overriding?\n> \n> Only by changing the ordering in the config file, as you noticed.\n> \n> The other http.* options will choose the most-specific match, but the\n> credential code predates that, and blindly goes in config order. Kyle\n> (cc'd) added the urlmatch support for http.*, and might be able to say\n> whether it could be adapted for the credential code. If so, then I think\n> it would need somebody to volunteer to work on it.\n> \n> That would technically be a backwards-incompatible change to switch the\n> lookup order at this point in time, but I'm somewhat of the opinion that\n> in any case it matters, the new behavior would be a strict improvement.\n> \n> -Peff\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"}]}