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

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

Pushing to https://github.com/username/username.github.io.git

fatal: could not read Username for 'https://github.com': Device not configured

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

But problem still remains, any effort will be appreciated.



Solution 1:[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:[2]

Mac OS: Android Studio Preferences -> Git -> at bottom, Use Credentials helper (make sure it is checked)

Windows: Android Studio File -> Settings -> Git -> Check Credentials Helper at bottom

Solution 3:[3]

@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'.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 larsks
Solution 2 Muhammad Ali
Solution 3 Mehdi Satei