59

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.

1

11 Answers 11

76

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

2
  • 4
    Thanks, this one solved it for me, but I had to restart Android Studio as well before the push actually worked for me. Jul 2, 2022 at 16:22
  • after this need restart android studio and made push again
    – Тони
    Oct 30, 2022 at 18:13
58

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.

8
  • "@bower_components/jquery.balloon.js": "github.com/urin/jquery.balloon.js.git#^1.0.3"
    – SACn
    Dec 1, 2017 at 6:18
  • 43
    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 5, 2018 at 18:58
  • 3
    After converting to ssh don't forget to change your remote url gist.github.com/developius/c81f021eb5c5916013dc
    – Squirrl
    Dec 7, 2018 at 16:36
  • 1
    @codrut answer helped me. Just remember to restart SourceTree then it works Apr 23, 2020 at 12:39
  • 1
    @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. Jun 29, 2020 at 14:26
11

I just closed Android Studio and started it again. The problem is fixed.

2
  • 1
    Unbelievable, tnx) got forget to restart guys..
    – Kelidon
    Dec 1, 2022 at 15:48
  • 1
    Unbelievable... Worked like a charm! Dec 15, 2022 at 18:23
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'.

0
2

This Gist helped a lot! Just 3 commands.

1
  • In my case, git was configured with sourcetree, fixing back to Mac OS keychain worked for me -> git config credential.helper osxkeychain Oct 20, 2022 at 13:23
1

Check this option in Android Studio File -> Settings -> Git -> Credentials Helper

If its not working even after checking 'Credentials helper' in settings then only restart the Android Studio and try to push code again.

1

I restarted the Android Studio and it worked for me

0

On Mac Updating keychain access entry for github worked for me.

refer this answer for details on how to update keychain access entry.

0

This should help solve this problem, since support for password authentication was removed on August 13, 2021.Please download and instal Git Credential Manager: https://github.com/GitCredentialManager/git-credential-manager/releases/tag/v2.0.785 Then you can use Android Studio and push all changes. After push Git Credential Manager will ask you for validation, and all should works perfect after all.

0

If this is the case for adding the pluggin dependecy in flutter by git reference

Make sure you have public access for the same repository. if private then go to bottom of general setting and make it public.

-2

For me, just install Github client for Mac fixed the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.