Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Windows Disable password prompt UI but get password prompt from shell

Tags:

git

git-bash

In git bash for windows, the username and/or password is asked in a separate UI popup prompt like below.

Username Prompt

On Hitting Cancel you get the below shell based prompt, where the same username can be input.

Shell based username prompt

Is there a way I can disable these prompts? I still do want to enter my username and password however instead of the UI based prompt, i want to enter it through the shell based prompt.

Using suggestions from this does not help. How to undo git config --system core.askpass git-gui--askpass

like image 598
Yogesh_D Avatar asked Dec 21 '15 13:12

Yogesh_D


People also ask

How do I stop Git from asking for password?

You can avoid being prompted for your password by configuring Git to cache your credentials for you. Once you've configured credential caching, Git automatically uses your cached personal access token when you pull or push a repository using HTTPS.


1 Answers

Try to set the variable core.askPass globally (in your config-file)

$ git config --global core.askPass true 

or use the -c switch to override it just for one command

$ git -c core.askPass=true clone <https_url> 

see: https://git-scm.com/docs/gitcredentials

If a helper outputs a quit attribute with a value of true or 1, no further helpers will be consulted, nor will the user be prompted (if no credential has been provided, the operation will then fail).

Note: un-setting the core.askPass by using git config --global --unset core.askPass doesn't help. It needs to be set to an true like above.

Update 2021-10-22:

The original answer proposed setting empty string "", but at least on Ubuntu this does not work and the docs also describe that the helper should output true or 1.

like image 85
hinneLinks Avatar answered Oct 06 '22 12:10

hinneLinks