Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

making git prompt for password in terminal

Tags:

git

terminal

I'm using git for one of my projects. Whenever I try to push to remote repo, git prompts me for password using a X window, so if I try to ssh to the computer and push I also have to X forward to make the window appear in my screen.

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

like image 770
Chakradar Raju Avatar asked Mar 16 '12 13:03

Chakradar Raju


People also ask

Why does Git not ask for password?

The most likely reason for this is that Git has been configured to use a credential helper. The configuration could have been made a) for all users in your system b) only for your user c) for a specific repository.


1 Answers

@Screwtape is (at least partially) correct, in his answer. If you look at this page, it shows the same problem (amid a larger problem), but it also indicates how to go around this error.

Whilst you are SSH'ing into the computer where you would like to run the git command, try:

$ unset SSH_ASKPASS

This unsets the $SSH_ASKPASS environment variable. If you then run the git command that you wanted to run, it should work. It works in my windows putty terminal in which I am SSH'ing to a CentOS server. Note that this unset change is NOT permanent (maybe a good thing) and you need to re-unset this parameter next time you login, but it gets the job done if you want to run GIT scripts.

Why is this bug still there, despite it being reported more than two years ago? From this source, it seems that Windows never sets the DISPLAY environment variable, and therefore GIT wouldn't work properly if it does make this check. The functionality is therefore left out (apparently) and the quote left by @Screwtape is correctly copied, but not applied in reality.

like image 191
Florian Mertens Avatar answered Oct 08 '22 02:10

Florian Mertens