git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Guilherme <guibufolo@gmail.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Fwd: git clone does not respect command line options
Date: Fri, 26 Feb 2016 02:34:44 -0500	[thread overview]
Message-ID: <20160226073444.GA26340@sigill.intra.peff.net> (raw)
In-Reply-To: <CAMDzUtxQPMty0Nncr7Yj3up6Zb6F-E0QudOMOZO_jG-Goq0YBg@mail.gmail.com>

On Fri, Feb 26, 2016 at 12:17:49PM +0530, Guilherme wrote:

> I'm trying to use git in an integration test and i'm having trouble
> with configuration options.
> 
> On windows developer machines we use wincred as our credenital helper
> and thus have it set in ~/.gitconfig
> 
> For the integration test that is no use as it will make testing
> unauthorized logging in impossible.
> 
> Since there is no way of disabling configuration options on the
> command line i tried setting it to store with a file I could delete.
> So in front of every command we insert `-c credential.helper="store
> --file=creds.txt"`. In the end the command line looks like:
> 
> git -c credential.helper="store --file=creds.txt" clone
> http://admin:admin@oururl@20000/TestRepo.git
> 
> I see the file creds.txt being created containing only
> http://admin:admin@oururl@20000/TestRepo.git but the credenital at the
> same time appears in the windows credential store.
> 
> Can anybody else confirm this?

That's behaving as expected. Unfortunately, you cannot currently do what
you want easily; there is no way to "unset" a multi-valued config
variable (like credential.helper) with a later one. Git will ask both
configured helpers for the password, and will store a successful result
in both.

The simplest way I can think of to work around it is to point your $HOME
elsewhere[1] during the integration test, so that it does not read your
regular ~/gitconfig.

-Peff

[1] Actually, that is what I would do on a Unix system. I have no idea
    how the home directory is determined on Windows.

  reply	other threads:[~2016-02-26  7:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAMDzUtzoiJWzckTX818HJV=su0eEP35gsNDJ=+k_me08EDvxRg@mail.gmail.com>
2016-02-26  6:47 ` Fwd: git clone does not respect command line options Guilherme
2016-02-26  7:34   ` Jeff King [this message]
2016-02-26  7:46     ` Guilherme
2016-02-26  7:59       ` Jeff King
2016-02-26  8:15         ` Jacob Keller
2016-02-26  8:24           ` Jeff King
2016-02-26  8:34             ` Duy Nguyen
2016-02-26  8:45               ` Jeff King
     [not found]             ` <CAMDzUtwG9pLz6CqxVEaw5xcZwQ2Ni37h_R45+frzJrRshgpZQg@mail.gmail.com>
2016-02-26  9:57               ` Jeff King
2016-02-26 16:59     ` Junio C Hamano
2016-02-28  3:37       ` Guilherme
     [not found]       ` <CAMDzUtxnSeTrfBWWqeOVQm30x5nE6fC9LSx=YNSws2h24TmchQ@mail.gmail.com>
2016-02-28  5:01         ` Jeff King

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=20160226073444.GA26340@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=guibufolo@gmail.com \
    /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).