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

北慕城南 提交于 2019-12-02 18:09:23

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

$ git config --global core.askPass ""

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

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

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

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

Use ssh instead of http/https.

You will need to set ssh keys on your local machine, upload them to your git server and replace the url form http:// to git:// and you will not need to use passwords anymore.

If you cant use ssh add this to your config:

[credential "https://example.com"]
    username = me

documents are here.

Unset SSH_ASKPASS.

unset SSH_ASKPASS

To do this automatically each time you open git bash, you can add the above line to the end of your .bashrc.

Investigation

The gitcredentials docs linked in other answers list a number of places git will check to determine how to ask for a password. I investigated each in turn:

env | grep GIT
git config --get core.askPass
env | grep SSH

The last command told me SSH_ASKPASS existed:

SSH_ASKPASS=/mingw64/libexec/git-core/git-gui--askpass`.

This is not part of my dotfiles, and so seems to come from the default Windows git distribution from http://git-scm.com.

You may try the configuration below:

git config --global --unset credential.helper

and

git config --system --unset credential.helper

This helped me while I am using PortableGit 64-bit 2.12.1.1 on Windows 7.

In my case I've been using git 1.9.5 for 3 years. And recently I tried to install latest version 2.15.0. In the latest git bash when I do git pull it was asking me to enter password whereas in old git version(1.9.5) it won't ask anything like that.

I did search in google. Finally my friend helped me to resolve that. It is because I've configured dsa key instead of rsa key. As per my understanding dsa is old key format and rsa is new key format.

To use the latest git bash with old dsa key I did the below thing, create a file named "config"(It is the full name) inside your .ssh folder. In that file give the below note,

PubkeyAcceptedKeyTypes=+ssh-dss

And save it.

Now open the latest git bash. And do git pull. It won't ask any password and just pull the commits.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!