@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.
ssh
's behavior notgit
.