{"thread":{"id":"44458","subject":"[credential.helper] unexpectedly save credential to multiple credential files","startedAt":"2016-11-11T08:11:01Z","lastAt":"2016-11-11T09:12:30Z","messageCount":3,"participants":["Qi Nark","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"305754","messageId":"CACNr1V_fRfqvHUN=AQC8-Dj7ZAE7KXRAt+5skL3ZrcKu7SCLgA@mail.gmail.com","threadId":"44458","inReplyTo":null,"subject":"[credential.helper] unexpectedly save credential to multiple credential files","fromName":"Qi Nark","fromEmail":"narcotics726@gmail.com","sentAt":"2016-11-11T08:10:55Z","receivedAt":"2016-11-11T08:11:01Z","isPatch":false,"sender":{"key":"narcotics726@gmail.com","avatar":null},"body":"1. git config --global credential.helper store\n2. cd to a local repository directory, git config credential.helper\nstore --file ./my_cred\n3. execute some git command which need credential like git ls-remote\n4. input my username & password, command done.\n\nAs the result, **BOTH** the ./my_cred and ~/.git-credentials will save\nthe credentials I just input. But, shouldn't the local config override\nthe global ones, and only the ./my_cred should save it?\n\nThx.\n"},{"id":"305757","messageId":"20161111083649.d5newszupwyq5j6w@sigill.intra.peff.net","threadId":"44458","inReplyTo":"CACNr1V_fRfqvHUN=AQC8-Dj7ZAE7KXRAt+5skL3ZrcKu7SCLgA@mail.gmail.com","subject":"Re: [credential.helper] unexpectedly save credential to multiple credential files","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-11-11T08:36:50Z","receivedAt":"2016-11-11T08:36:57Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Nov 11, 2016 at 04:10:55PM +0800, Qi Nark wrote:\n\n> 1. git config --global credential.helper store\n> 2. cd to a local repository directory, git config credential.helper\n> store --file ./my_cred\n> 3. execute some git command which need credential like git ls-remote\n> 4. input my username & password, command done.\n> \n> As the result, **BOTH** the ./my_cred and ~/.git-credentials will save\n> the credentials I just input. But, shouldn't the local config override\n> the global ones, and only the ./my_cred should save it?\n\nNo, that's the expected result. The set of credential helpers form a\nlist, and each is run in turn. From \"git help credentials\":\n\n  If there are multiple instances of the credential.helper configuration\n  variable, each helper will be tried in turn, and may provide a\n  username, password, or nothing. Once Git has acquired both a username\n  and a password, no more helpers will be tried.\n\nThat's talking about lookup, but the same principle applies to storage.\nBut you may also find the paragraph below helpful:\n\n  If credential.helper is configured to the empty string, this resets\n  the helper list to empty (so you may override a helper set by a\n  lower-priority config file by configuring the empty-string helper,\n  followed by whatever set of helpers you would like).\n\nNote that the \"reset\" behavior was introduced in git v2.9.0, so you'll\nneed at least that version.\n\n-Peff\n"},{"id":"305762","messageId":"CACNr1V_BE_m32sw1D4WnRjRfPHEdKa0mb1jcv6BG0VPATtyPFQ@mail.gmail.com","threadId":"44458","inReplyTo":"20161111083649.d5newszupwyq5j6w@sigill.intra.peff.net","subject":"Re: [credential.helper] unexpectedly save credential to multiple credential files","fromName":"Qi Nark","fromEmail":"narcotics726@gmail.com","sentAt":"2016-11-11T09:12:17Z","receivedAt":"2016-11-11T09:12:30Z","isPatch":false,"sender":{"key":"narcotics726@gmail.com","avatar":null},"body":"On Fri, Nov 11, 2016 at 4:36 PM, Jeff King <peff@peff.net> wrote:\n> On Fri, Nov 11, 2016 at 04:10:55PM +0800, Qi Nark wrote:\n>\n>> 1. git config --global credential.helper store\n>> 2. cd to a local repository directory, git config credential.helper\n>> store --file ./my_cred\n>> 3. execute some git command which need credential like git ls-remote\n>> 4. input my username & password, command done.\n>>\n>> As the result, **BOTH** the ./my_cred and ~/.git-credentials will save\n>> the credentials I just input. But, shouldn't the local config override\n>> the global ones, and only the ./my_cred should save it?\n>\n> No, that's the expected result. The set of credential helpers form a\n> list, and each is run in turn. From \"git help credentials\":\n>\n>   If there are multiple instances of the credential.helper configuration\n>   variable, each helper will be tried in turn, and may provide a\n>   username, password, or nothing. Once Git has acquired both a username\n>   and a password, no more helpers will be tried.\n>\n> That's talking about lookup, but the same principle applies to storage.\n> But you may also find the paragraph below helpful:\n>\n>   If credential.helper is configured to the empty string, this resets\n>   the helper list to empty (so you may override a helper set by a\n>   lower-priority config file by configuring the empty-string helper,\n>   followed by whatever set of helpers you would like).\n>\n> Note that the \"reset\" behavior was introduced in git v2.9.0, so you'll\n> need at least that version.\n>\n> -Peff\n\n\nOk, that's fair enough. Thanks for your detailed explanation. The\nversion info is very important to me.\n\nThank you again.\n"}]}