Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to prevent git from opening a password prompt box on Windows?

While pushing on a remote repository using git bash, my password is required and asked. This is not a problem.

The issue is that I was used to just type my password into the git console, but then I switched from Linux to Windows and my password is asked into a prompt box instead of the console.

Prompt box for password

I find it much less convenient: I have to wait for one second that it appears and sometimes I lose the focus.

What is strange is that if I close the dialog box, then the password is asked from within the git console. This is what I am looking for.

What I am looking for

Do you know how could I prevent the box to be prompted and just let me type my password into the console, please? Is there some git option I should modify?

like image 994
Delgan Avatar asked Jan 20 '16 17:01

Delgan


People also ask

How do I stop Git 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.

Why does GitHub keep asking for my password?

If Git prompts you for a username and password every time you try to interact with GitHub, you're probably using the HTTPS clone URL for your repository.


1 Answers

This seems to be related with the core.askPass option of git-config.

The documentation says:

core.askPass
Some commands (e.g. svn and http interfaces) that interactively ask for a password can be told to use an external program given via the value of this variable. Can be overridden by the GIT_ASKPASS environment variable. If not set, fall back to the value of the SSH_ASKPASS environment variable or, failing that, a simple password prompt. The external program shall be given a suitable prompt as command-line argument and write the password on its STDOUT.


My default configuration contains nothing about this option, so I guess it fall back to the "simple password prompt".

To override this behavior, I just had to set the option to an empty string:

git config --global core.askPass ''

Then, the password is asked from the console without prompting anything.

like image 146
Delgan Avatar answered Nov 14 '22 23:11

Delgan