0

Is there a way to run the Git Credential helper on Windows without asking for username/password if there is no stored information?

The git credential command provides the fill command, allowing to retrieve credentials for a Git repo. If there is stored credential information, it prints it to stdout.

If there is no stored information for the requested repo, it opens a prompt or Windows dialog to ask for the credentials. Can this be avoided?

To replicate:

url=http://foo [ENTER] [ENTER]

Make sure to end with two blank lines to tell the credential helper that your input is finished.

Since the Git credential helper shouldn't have any stored information for this repo, it will prompt you for your credentials. On Windows, this is done using a system credential dialog (similar to the login dialog).

Is there a way to avoid this prompt? What I'm looking for is something like a return code indicating that there was no stored information for the requested repo. At the moment, this doesn't seem to be possible, the credential helper always asks for the credentials.

nwinkler
  • 52,665
  • 21
  • 154
  • 168

1 Answers1

1

There doesn't seem a way to avoid that prompt for credentials.

I usually use a different credential helper, based on an gpg-encrypted .netrc (or _netrc on Windows) and the official contrib/credential/netrc/test.netrc perl script, which I modify a bit.
That way, I only have to enter one password during the session, and all the different credentials stored in the encrypted .netrc are available for all the site.

Since there is a gpg agent running, I don't have to enter that same password during the current session.

I use that same script to check if a site has credential information or not with:

echo host=a.site.com | ./git-credential-netrc -f path/to/.netrc.asc get

The 'get' command should be respected by any git credential helper, so check if a similar command would work with git-credential-winstore command.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250