Frage

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 closes when another window becomes active, which is just fine. What is not fine, however, is that when I use git and have it pull or push to an https url, it pops up a fun box to ask me for my password instead of just letting me enter it directly on the command line.

Normally I would google around to find the answer to this, but sadly most people are trying to get git to stop asking for a password altogether rather than prevent a dialog box, so this is hard for me to google (trust me; I've tried for a couple months now on and off when I get annoyed enough).

How can I prevent git from popping up any graphical windows for things like passwords? Git says that it is using /usr/lib/seahorse/seahorse-ssh-askpass for asking the password, so if there is some configuration option to prevent it from using that (or that has an equivalent effect), that would be great.

Thanks very much for any help.

War es hilfreich?

Lösung

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

Andere Tipps

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
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top