Creating git password request in terminal

I am using git for one of my projects. Whenever I try to click on a remote repo, git asks me for the password using the X window, so if I try to transfer ssh to the computer and click, I also need X forward so that the window appears on my screen.

Is it possible to make a git request for a password in the terminal itself?

+7
source share
2 answers

@Screwtape (at least partially) fixed in his answer . If you look at this page , it shows the same problem (against the background of a larger problem), but also indicates how to get around this error.

While you are using SSH on the computer where you want to run the git command, try:

$ unset SSH_ASKPASS 

This disables the environment variable $ SSH_ASKPASS. If you then run the git command that you want to run, it should work. It works on my Windows plug-in terminal, in which I am SSH'ing on a CentOS server. Note that this uninstalled change is NOT permanent (maybe good), and you need to re-disable this option the next time you log in, but it does the job if you want to run git scripts.

Why does this error still exist despite being reported more than two years ago? From this source, it seems that Windows never sets the DISPLAY environment variable, and therefore git will not work properly if it performs this check. Thus, the functionality is abandoned (apparently), and the quote left by @Screwtape is correctly copied, but not really applied.

+5
source

This is not git behavior; you click on the repo via SSH and SSH asks for your password. The ssh page says:

If ssh does not have a terminal connected to it, but DISPLAY and SSH_ASKPASS are installed, it will execute the program indicated by SSH_ASKPASS and open the X11 window to read the passphrase.

Usually, when you ssh to a remote host, ssh clears the DISPLAY variable to prevent such problems, but perhaps you can configure ssh to distribute more environment variables than the default configuration allows. In this case, make sure ssh does not copy the DISPLAY variable to the remote host (if you need X11 forwarding, ssh will create its own new DISPLAY variable, it will not be your original). This should prevent ssh-askpass from ssh-askpass on the server you are running git on.

+2
source

All Articles