64

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,329
  • 4
  • 14
  • 34
  • Does this answer your question? [GitHub Action: fatal: could not read Username for 'https://github.com': Device not configured](https://stackoverflow.com/questions/71975373/github-action-fatal-could-not-read-username-for-https-github-com-device-n) – محمد جعفر نعمة Oct 15 '22 at 02:23

12 Answers12

83

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
  • 1,055
  • 6
  • 11
65

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
  • 277,717
  • 41
  • 399
  • 399
  • "@bower_components/jquery.balloon.js": "https://github.com/urin/jquery.balloon.js.git#^1.0.3" – SACn Dec 01 '17 at 06:18
  • 44
    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
  • 3
    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
  • 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. – 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
  • In our case, we were trying to pull from a repo that was accidently set as pravite. Normally if we run git pull we were asked to input username, but the interaction is impossible during a Jenkins pipeline process, so an error was thrown "No such device or address". Updating the repo to "public" fixed our issue. – MadHatter Nov 01 '22 at 06:10
15

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

Mahmut K.
  • 707
  • 1
  • 8
  • 20
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'.

Mehdi Satei
  • 1,225
  • 9
  • 26
3

This Gist helped a lot! Just 3 commands.

minomy13
  • 120
  • 1
  • 9
  • In my case, git was configured with sourcetree, fixing back to Mac OS keychain worked for me -> git config credential.helper osxkeychain – Shanki Bansal Oct 20 '22 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.

waleed
  • 49
  • 4
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.

Rahul Tiwari
  • 6,851
  • 3
  • 49
  • 78
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 you are on google colab, running the clone command on the terminal instead of the notebook will, most probably, do the trick.

Maged Saeed
  • 1,784
  • 2
  • 16
  • 35
0

What solved it for me was this:

  1. I restarted android studio
  2. I ran flutter pub get
  3. Github then asked me for my username and password. I entered them. The password I entered was my github access token, not my actual github password.

Hope it helps someone.

Frankdroid7
  • 158
  • 2
  • 6
-2

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

Orange
  • 349
  • 3
  • 13