Prevent git from popping up gnome password box

后端 未结 2 1449
难免孤独
难免孤独 2021-02-03 23:00

I have not asked a question of this nature before, so this may not be the correct site for this.

I use the xfce terminal in drop-down mode connected to a hotkey. It clos

相关标签:
2条回答
  • 2021-02-03 23:23

    It seems like git is probably using the GIT_ASKPASS or SSH_ASKPASS environment variables to figure out if it should use a separate program to prompt for passwords.

    Try running unset GIT_ASKPASS or unset SSH_ASKPASS. Now try pushing or pulling from a git repository. If that works, add the appropriate command to .bashrc, .zshrc, or whatever file you use to run a command when your shell starts.

    You can also override the value of git's core.askpass setting with git config --global core.askpass YOUR_PREFERRED_PROMPT_COMMAND.

    Relevant information from the git-config man page:

    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.

    Original source: http://kartzontech.blogspot.com/2011/04/how-to-disable-gnome-ssh-askpass.html

    0 讨论(0)
  • 2021-02-03 23:27

    unset DISPLAY when running git commands that might need password, and gnome-ssh-askpass will use a text terminal prompt.

    For example:

    DISPLAY= git push
    
    0 讨论(0)
提交回复
热议问题