41

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.

Community
  • 1
  • 1
Tangoo
  • 1,069
  • 3
  • 13
  • 33

3 Answers3

45

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.

larsks
  • 228,688
  • 37
  • 348
  • 338
  • "@bower_components/jquery.balloon.js": "https://github.com/urin/jquery.balloon.js.git#^1.0.3" – SACn Dec 01 '17 at 06:18
  • 40
    If anybody using SourceTree, similar error was fixed by going to Preferences -> tab Git -> section Git version -> button Use System Git, and select from the dialog 'git'. It appears that after an update it forgot where it's command line tools are – codrut Apr 05 '18 at 18:58
  • 2
    After converting to ssh don't forget to change your remote url https://gist.github.com/developius/c81f021eb5c5916013dc – Squirrl Dec 07 '18 at 16:36
  • 1
    @codrut answer helped me. Just remember to restart SourceTree then it works – ymerdrengene Apr 23 '20 at 12:39
  • @codrut That did it for me too. Thanks you. Could you perhaps put that in a dedicated answer? From your upvotes it looks like it helps many people. – Gerben Rampaart Jun 29 '20 at 14:26
  • @codrut - setting `credential.helper` to sourcetree did it for me. Source: https://gist.github.com/RockinPaul/6b012b106c4175469ee39bde12fb67f7 – fpersyn Sep 02 '20 at 12:27
  • @codrut Bless you!! i'll post that as an answer maybe it is easier for others to see this – Mehdi Satei Sep 20 '21 at 12:25
22

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

Muhammad Ali
  • 421
  • 3
  • 7
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'.

Mehdi Satei
  • 883
  • 8
  • 22
  • Thank you. Mention notifications don't seem to work, just now I saw the popular demand to have it in a separate answer. Glad it helped, cheers! – codrut Sep 21 '21 at 13:27