triffic triffic - 3 months ago 60
Git Question

Fatal: could not read username for 'https //' device not configured

I am trying to push code to github with SublimeGit plugin, but something weird occurs to me.

Pushing to

fatal: could not read Username for '': Device not configured

Have been taken a lot of search before asking, like fatal: could not read Username for '': No such file or directory, Fatal: could not read Username for '': No such device or address.

But problem still remains, any effort will be appreciated.


You get that error (fatal: could not read Username for '': Device not configured) when git needs to ask for a username or password and (a) the only mechanism available to it is to ask on the console and (b) there is no console available (git is not attached to a tty device, i.e., you're not running git interactively).

This commonly happens in an environment where you are invoking git from some sort of gui tool and no appropriate credentials helper has been configured.

There are a variety of ways of addressing this problem:

  • One of the easiest is to move to using ssh authentication rather than https.

  • You could hardcode the credentials for github into your local git repository, as described in the gitcredentials documentation.

  • You could configure an appropriate helper application. One may already be configured, but git may simply not be able to find it. The gitcredentials man page has information on this option as well.