Android Studio Bumblebee 211版本Git push时报“could not read Username for 'xxx': Device not configured”错误的解决办法
很久没有做Android开发了,最近上海遇到抢菜高峰,为了家里能有稳定的食物来源,我不得不使用重启这部分专业知识来完成一些小小的工作。
时隔几年之后,Android Studio(以下简称AS)也有了多个版本的升级,我照例把开发环境升级到最新版,版本信息如下:
Android Studio Bumblebee | 2021.1.1 Patch 3
Build #AI-211.7628.21.2111.8309675, built on March 17, 2022
Runtime version: 11.0.11+0-b60-7590822 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.7
GC: G1 Young Generation, G1 Old Generation
Memory: 1280M
Cores: 16
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: Lombook Plugin (0.34.1-2019.1), org.intellij.plugins.markdown (211.7142.37)
当我开发好之后想要推送代码到Github时,AS突然报了个错给我,如下图:
具体信息如下:
21:02:26.126: [food-grabber] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false push --progress --porcelain origin refs/heads/master:master --set-upstream
Invocation failed Unexpected end of file from server
java.lang.RuntimeException: Invocation failed Unexpected end of file from server
at org.jetbrains.git4idea.GitAppUtil.sendXmlRequest(GitAppUtil.java:30)
at org.jetbrains.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 org.jetbrains.git4idea.GitAppUtil.sendXmlRequest(GitAppUtil.java:27)
... 1 more
error: unable to read askpass response from '/Users/xxx/Library/Caches/Google/AndroidStudio2021.1/tmp/intellij-git-askpass-local.sh'
fatal: could not read Username for 'http://gitxxx.com': Device not configured
搜到的解决办法多数是让我到“.git”目录下修改“config”文件,把用户名和密码加到Git远程地址的URL中,如下,其中xxx是用户名,yyy是密码:
[remote "origin"]
url = http://xxx:yyy@github.com/aaa/bbb.git
fetch = +refs/heads/*:refs/remotes/origin/*
然而这个解决方法对我无效,多方查证无果,最后在一个国外网站上找到了相关的解决办法,只需勾选一个选项即可解决问题。如下图:
勾选之后再次提交,问题解决。
21:06:01.750: [food-grabber] git -c core.quotepath=false -c log.showSignature=false push --progress --porcelain origin refs/heads/master:master --set-upstream
Enumerating objects: 66, done.
Counting objects: 1% (1/66)
Counting objects: 100% (66/66), done.
Delta compression using up to 16 threads
Compressing objects: 1% (1/55)
Compressing objects: 100% (55/55), done.
Writing objects: 1% (1/66)
Writing objects: 100% (66/66), 136.46 KiB | 13.65 MiB/s, done.
Total 66 (delta 2), reused 0 (delta 0), pack-reused 0
To http://git.hotsun168.com/HomeApps/food-grabber.git
* refs/heads/master:refs/heads/master [new branch]
Branch 'master' set up to track remote branch 'master' from 'origin'.
Done
什么时候熊厂能够给点力???