Fatal: could not read username for 'https //github.com' device not configured Fatal: could not read username for 'https //github.com' device not configured git git

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


You get that error (fatal: could not read Username for 'https://github.com': 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.


@codrus's comment helped me fixing the issue on sourcetreeGo to Preferences -> tab Git -> section Git version -> button Use System Git, and select from the dialog 'git'.