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:
- Install the Windows credential helper from https://gitcredentialstore.codeplex.com/
- Run
git credential fill
and then enter the following in the command window:
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.