4

What might be the problem with my local git ? I was able to pull just before 5 minutes, and all of the sudden when I tried to pull again, it asked me to enter user/psw. I did that, but it gave me this error:

Git failed with a fatal error.
could not read Username for 'https://github.com': terminal prompts disabled

I am able to login in github.com, but locally it keeps asking me user/password and gives me the above error.

Note: When using github for desktop it's all okay.

display_name
  • 91
  • 1
  • 1
  • 7

1 Answers1

2

You, or some software you are using, has set:

GIT_TERMINAL_PROMPT=0

or:

GIT_TERMINAL_PROMPT=false

in your environment. Stop doing that, or make the software stop doing that. (See also go get results in 'terminal prompts disabled' error for github private repo and How do I disable credential prompting for git clone in Go?)

Alternatively, set up your credential manager1 to store or cache the user name and password. Be careful with this, especially because many of these store passwords insecurely (e.g., in cleartext).

Alternatively, use ssh instead of https. While https authentication requires that Git obtain a user name and password from a credential manager, ssh authentication does not.


1Git itself doesn't do any authentication. Instead, it fobs this off on other programs or libraries. To use https authentication, Git has to invoke library routines, for which it needs a user name and password; to obtain the user name and password, Git invokes a separate credential manager. There are many credential managers, and they are both OS- and user-dependent, so that you can choose a credential manager that works only on your Mac, or one that works only on your Windows system. Git also comes with some simple-and-dumb credential managers that just store the user name and password in a file, or in some temporary storage.

torek
  • 448,244
  • 59
  • 642
  • 775