Suppressing Git CredentialHelperSelector on git 2.22.0?

2,842 views
Skip to first unread message

Mark Waite

unread,
Jun 13, 2019, 10:44:55 AM6/13/19
to git-for-windows
I maintain the Jenkins git client plugin.  It uses command line git to perform git operations in Jenkins.

While running the git client plugin automated tests with git for windows 2.22.0 on my Windows 10 computer, a window appears titled "CredentialHelperSelector".  The Jenkins git client plugin is intended for batch use rather than interactive use.  However, Jenkins agents can be run from either a desktop environment (run Selenium tests, interact with Windows desktop apps, etc.) or from a service.  In both cases, I do not want to rely on the user clicking in a window to answer a prompt to configure the credentials manager.

Is there a command line git 2.22.0 setting that will prevent CredentialHelperSelector from being displayed?

Is there a way to decide that the user has already configured a credential manager so that the git client plugin does not modify local changes made by the user?

Mark Waite

James Nord

unread,
Jun 13, 2019, 10:55:53 AM6/13/19
to Mark Waite, git-for-windows
You can try setting the git config for `credential.helper` to something?   https://git-scm.com/docs/gitcredentials 

I don't have any popups and can not recall what I installed but my entry is "manager" which is  https://github.com/microsoft/Git-Credential-Manager-for-Windows  IIRC.

HTH

/James 

--
You received this message because you are subscribed to the Google Groups "git-for-windows" group.
To unsubscribe from this group and stop receiving emails from it, send an email to git-for-windo...@googlegroups.com.
To post to this group, send email to git-for...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/git-for-windows/fd07df82-a0fe-4d2a-a63d-565010135b15%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mark Waite

unread,
Jun 13, 2019, 11:13:30 AM6/13/19
to James Nord, git-for-windows
Having selected git credential manager for Windows, if you then run a Jenkins agent on your Windows machine, that will cause credential popups to appear on at least some of the versions of git for Windows.

I specifically chose to have no credential manager installed when I installed git for Windows as a way to reduce the risk that I would have popups.  

I also installed the Portable Git for Windows so that I can copy that installation onto any Windows machine in my test environment without running the installer.

I believe that the Jenkins git client plugin automated tests (or runtime, I forget which) are already setting an explicit value for credential.helper.  However, my belief is not yet backed by a detailed review of the code and the cases where the tests are displaying that dialog.  I'll investigate that further.  Thanks!
--
Thanks!
Mark Waite

Mark Waite

unread,
Jun 13, 2019, 11:25:23 AM6/13/19
to James Nord, git-for-windows
It looks like there is a setting written to the user .gitconfig file:

credential.helperselector.selected=<no helper>

I think the Jenkins git client plugin will need to see that value if it detects that it is running on Windows and command line git 2.22.0 or later is detected.  Does that seem reasonable?
--
Thanks!
Mark Waite

Mark Waite

unread,
Jun 13, 2019, 11:26:03 AM6/13/19
to James Nord, git-for-windows
Ugh, off by  one character and completely changed the meaning of the sentence.

On Thu, Jun 13, 2019 at 9:25 AM Mark Waite <mark.ea...@gmail.com> wrote:
It looks like there is a setting written to the user .gitconfig file:

credential.helperselector.selected=<no helper>

I think the Jenkins git client plugin will need to see that value if it detects that it is running on Windows and command line git 2.22.0 or later is detected.  Does that seem reasonable?

I think the Jenkins git client plugin will need to set that value if it detects that it is running on Windows and command line git 2.22.0 or later is detected.  Does that seem reasonable?  


--
Thanks!
Mark Waite

Johannes Schindelin

unread,
Jun 13, 2019, 12:44:19 PM6/13/19
to Mark Waite, James Nord, git-for-windows
Hi Mark,

On Thu, 13 Jun 2019, Mark Waite wrote:

> On Thu, Jun 13, 2019 at 9:25 AM Mark Waite <mark.ea...@gmail.com>
> wrote:
>
> > It looks like there is a setting written to the user .gitconfig file:
> >
> > credential.helperselector.selected=<no helper>
> >
> > I think the Jenkins git client plugin will need to see that value if it
> > detects that it is running on Windows and command line git 2.22.0 or later
> > is detected. Does that seem reasonable?
>
> I think the Jenkins git client plugin will need to *set* that value if it
> detects that it is running on Windows and command line git 2.22.0 or later
> is detected. Does that seem reasonable?

Sorry about the troubles.

The safest way is to override the `credential.helper = helper-selector`
setting. Either you do that in the unpacked Portable Git, via

.../cmd/git config --system credential.helper ""

or by doing the same in `.gitconfig`:

[credential]
helper =

So why not just unset it? That is explained in
https://git-scm.com/docs/gitcredentials#Documentation/gitcredentials.txt-helper:
you can have multiple helpers that are called in succession until
authentication succeeded. However, once an empty value is found, that list
of helpers is re-set to the empty list. Exactly what you need.

Ciao,
Johannes

Mark Waite

unread,
Jun 13, 2019, 4:55:19 PM6/13/19
to Johannes Schindelin, James Nord, git-for-windows
On Thu, Jun 13, 2019 at 10:44 AM Johannes Schindelin  wrote:
Hi Mark,

On Thu, 13 Jun 2019, Mark Waite wrote:

> On Thu, Jun 13, 2019 at 9:25 AM Mark Waite wrote:
>
> > It looks like there is a setting written to the user .gitconfig file:
> >
> > credential.helperselector.selected=<no helper>
> >
> > I think the Jenkins git client plugin will need to see that value if it
> > detects that it is running on Windows and command line git 2.22.0 or later
> > is detected.  Does that seem reasonable?
>
> I think the Jenkins git client plugin will need to *set* that value if it
> detects that it is running on Windows and command line git 2.22.0 or later
> is detected.  Does that seem reasonable?

Sorry about the troubles.

The safest way is to override the `credential.helper = helper-selector`
setting. Either you do that in the unpacked Portable Git, via

        .../cmd/git config --system credential.helper ""

or by doing the same in `.gitconfig`:

        [credential]
                helper =


Thanks.  As far as I can tell, I already had that in my configuration and was still seeing the pop-up window.  The pop-up window has not reappeared since I added:

credential.helperselector.selected=<no helper>

Is it unsafe or unhealthy to set 'credential.helperselector.selected=<no helper>' when I'm using a working directory inside a batch process like the Jenkins git client plugin does?

Thanks

 
So why not just unset it? That is explained in
https://git-scm.com/docs/gitcredentials#Documentation/gitcredentials.txt-helper:
you can have multiple helpers that are called in succession until
authentication succeeded. However, once an empty value is found, that list
of helpers is re-set to the empty list. Exactly what you need.

Ciao,
Johannes


--
Thanks!
Mark Waite

Johannes Schindelin

unread,
Jun 14, 2019, 2:51:01 PM6/14/19
to Mark Waite, James Nord, git-for-windows
Hi Mark,

On Thu, 13 Jun 2019, Mark Waite wrote:

> On Thu, Jun 13, 2019 at 10:44 AM Johannes Schindelin wrote:
>
> > On Thu, 13 Jun 2019, Mark Waite wrote:
> >
> > > On Thu, Jun 13, 2019 at 9:25 AM Mark Waite wrote:
> > >
> > > > It looks like there is a setting written to the user .gitconfig
> > > > file:
> > > >
> > > > credential.helperselector.selected=<no helper>
> > > >
> > > > I think the Jenkins git client plugin will need to see that value
> > > > if it detects that it is running on Windows and command line git
> > > > 2.22.0 or later is detected. Does that seem reasonable?
> > >
> > > I think the Jenkins git client plugin will need to *set* that value
> > > if it detects that it is running on Windows and command line git
> > > 2.22.0 or later is detected. Does that seem reasonable?
> >
> > Sorry about the troubles.
> >
> > The safest way is to override the `credential.helper = helper-selector`
> > setting. Either you do that in the unpacked Portable Git, via
> >
> > .../cmd/git config --system credential.helper ""
> >
> > or by doing the same in `.gitconfig`:
> >
> > [credential]
> > helper =
>
> Thanks. As far as I can tell, I already had that in my configuration and
> was still seeing the pop-up window.

Hmm. That is strange. You might have uncovered a bug. Can you check what
`git config --show-origin --get-all credential.helper` says?

> The pop-up window has not reappeared since I added:
>
> credential.helperselector.selected=<no helper>

This actually should only make sure that the default is to use no helper,
but the GUI would still be shown.

> Is it unsafe or unhealthy to set 'credential.helperselector.selected=<no
> helper>' when I'm using a working directory inside a batch process like the
> Jenkins git client plugin does?

I would be surprised if it did what you want it to do...

Really, what you want is to disable the helper-selector altogether, and I
still think that setting `credential.helper` to the empty value in your
`$HOME/.gitconfig` is the way to go.

Ciao,
Johannes

Mark Waite

unread,
Jun 15, 2019, 8:32:53 PM6/15/19
to Johannes Schindelin, James Nord, git-for-windows
Now I can no longer duplicate the condition that I was seeing.  If it reappears or I discover a way to duplicate it again, I'll investigate further.
--
Thanks!
Mark Waite
Reply all
Reply to author
Forward
0 new messages