"could not read Username" failure on Push. No recent config changes


I went to push some code using the Android Studio plugin (how I always interact with GitHub). And got this error:

could not read Username for ‘https://github.com’: Device not configured
I’ll put the whole thing at the bottom.

I haven’t changed anything in regards to GitHub config recently.

I checked for my Personal Access token if it could have expired. Nope.

I checked if I somehow was not on https anymore (searching around this was the most common problem). Also nope. This is what I want, right?

MacBook-Pro:[project] kaitlyn$ git remote -v
origin https://github.com/kaitlynh/[project]s.git (fetch)
origin https://github.com/kaitlynh/[project].git (push)

And those are all the ideas I have. Can anyone please help me where to look for what broke?

Full error when I go to Push from Android Studio Git console:

11:02:11.494: [*project*] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false commit -F /private/var/folders/bs/*[]*/T/git-commit-msg-.txt --
[master fcbe4506] *[commit comment]*
 4 files changed, 25 insertions(+), 26 deletions(-)
11:02:21.170: [*project*] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false push --progress --porcelain origin refs/heads/master:master
Invocation failed Unexpected end of file from server
java.lang.RuntimeException: Invocation failed Unexpected end of file from server
	at git4idea.GitAppUtil.sendXmlRequest(GitAppUtil.java:30)
	at git4idea.http.GitAskPassApp.main(GitAskPassApp.java:58)
Caused by: java.net.SocketException: Unexpected end of file from server
	at java.base/sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:866)
	at java.base/sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:689)
	at java.base/sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:863)
	at java.base/sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:689)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1615)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)
	at org.apache.xmlrpc.DefaultXmlRpcTransport.sendXmlRpc(DefaultXmlRpcTransport.java:87)
	at org.apache.xmlrpc.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:72)
	at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:194)
	at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:185)
	at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:178)
	at git4idea.GitAppUtil.sendXmlRequest(GitAppUtil.java:27)
	... 1 more
error: unable to read askpass response from '/Users/kaitlyn/Library/Caches/Google/AndroidStudio2021.2/tmp/intellij-git-askpass-local.sh'
fatal: could not read Username for 'https://github.com': Device not configured
1 Like

Update next day:

I regenerated the Personal Access Token, then deleted and recreated the GitHub account in Android Studio settings. No change.

I looked at the file at the end of the error:
I don’t know how to read this file. If anyone does, do you see anything wrong?

"/Applications/Android Studio 2.app/Contents/jre/Contents/Home/bin/java" -cp "/Applications/Android Studio 2.app/Contents/plugins/git4idea/lib/git4idea-rt.jar:/Applications/Android Studio 2.app/Contents/lib/xmlrpc-2.0.1.jar:/Applications/Android Studio 2.app/Contents/lib/commons-codec-1.15.jar" git4idea.http.GitAskPassApp "$@"

I also tried some commands from the terminal to try to eliminate Android Studio from the issue. git status worked fine. git push prompted me for my username and password, then told me Support for password authentication was removed on August 13, 2021. Please use a personal access token instead. Of course, I have been using a personal access token until it just stoped working yesterday without my changing anything.

1 Like

Looks like PAT simply was caching incorrectly.
Machine restart fixed the issue.