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

54,276

Solution 1

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.

Solution 2

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

Share:
54,276
Tangoo
Author by

Tangoo

It's cool to coding.

Updated on July 09, 2022

Comments