git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qi Nark <narcotics726@gmail.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [credential.helper] unexpectedly save credential to multiple credential files
Date: Fri, 11 Nov 2016 17:12:17 +0800	[thread overview]
Message-ID: <CACNr1V_BE_m32sw1D4WnRjRfPHEdKa0mb1jcv6BG0VPATtyPFQ@mail.gmail.com> (raw)
In-Reply-To: <20161111083649.d5newszupwyq5j6w@sigill.intra.peff.net>

On Fri, Nov 11, 2016 at 4:36 PM, Jeff King <peff@peff.net> wrote:
> On Fri, Nov 11, 2016 at 04:10:55PM +0800, Qi Nark wrote:
>
>> 1. git config --global credential.helper store
>> 2. cd to a local repository directory, git config credential.helper
>> store --file ./my_cred
>> 3. execute some git command which need credential like git ls-remote
>> 4. input my username & password, command done.
>>
>> As the result, **BOTH** the ./my_cred and ~/.git-credentials will save
>> the credentials I just input. But, shouldn't the local config override
>> the global ones, and only the ./my_cred should save it?
>
> No, that's the expected result. The set of credential helpers form a
> list, and each is run in turn. From "git help credentials":
>
>   If there are multiple instances of the credential.helper configuration
>   variable, each helper will be tried in turn, and may provide a
>   username, password, or nothing. Once Git has acquired both a username
>   and a password, no more helpers will be tried.
>
> That's talking about lookup, but the same principle applies to storage.
> But you may also find the paragraph below helpful:
>
>   If credential.helper is configured to the empty string, this resets
>   the helper list to empty (so you may override a helper set by a
>   lower-priority config file by configuring the empty-string helper,
>   followed by whatever set of helpers you would like).
>
> Note that the "reset" behavior was introduced in git v2.9.0, so you'll
> need at least that version.
>
> -Peff


Ok, that's fair enough. Thanks for your detailed explanation. The
version info is very important to me.

Thank you again.

      reply	other threads:[~2016-11-11  9:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-11  8:10 [credential.helper] unexpectedly save credential to multiple credential files Qi Nark
2016-11-11  8:36 ` Jeff King
2016-11-11  9:12   ` Qi Nark [this message]

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=CACNr1V_BE_m32sw1D4WnRjRfPHEdKa0mb1jcv6BG0VPATtyPFQ@mail.gmail.com \
    --to=narcotics726@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /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).