Prevent git from popping up gnome password box Prevent git from popping up gnome password box linux linux

Prevent git from popping up gnome password box


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


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