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

后端 未结 5 720
深忆病人
深忆病人 2021-01-31 09:50

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

On Hitting Cancel you get the below shell based prompt

相关标签:
5条回答
  • 2021-01-31 10:11

    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.

    0 讨论(0)
  • 2021-01-31 10:12

    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.

    0 讨论(0)
  • 2021-01-31 10:20

    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.

    0 讨论(0)
  • 2021-01-31 10:23

    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.

    0 讨论(0)
  • 2021-01-31 10:30

    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.

    0 讨论(0)
提交回复
热议问题