无法 git 在 android studio 3.6 中推送或拉取

Not able to git push or pull in android studio 3.6

我在 android studio 3.6

中尝试使用 ssh 进行推拉或任何操作时出现以下错误

Update failed Invocation failed Unexpected Response from Server: Unauthorized java.lang.RuntimeException: Invocation failed Unexpected Response from Server: Unauthorized at org.jetbrains.git4idea.nativessh.GitNativeSshAskPassXmlRpcClient.handleInput(GitNativeSshAskPassXmlRpcClient.java:34) at org.jetbrains.git4idea.nativessh.GitNativeSshAskPassApp.main(GitNativeSshAskPassApp.java:30) Caused by: java.io.IOException: Unexpected Response from Server: Unauthorized at org.apache.xmlrpc.LiteXmlRpcTransport.sendRequest(LiteXmlRpcTransport.java:231) at org.apache.xmlrpc.LiteXmlRpcTransport.sendXmlRpc(LiteXmlRpcTransport.java:90) 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.nativessh.GitNativeSshAskPassXmlRpcClient.handleInput(GitNat..................

看起来问题出在本机 ssh 上,我们无法像以前的版本那样将其更改为内置...如何解决这个问题???

任何帮助将不胜感激

不是直接的解决方案 - 但您可以将 git url 从 ssh 更改为 https,它会起作用。

git remote set-url origin YOUR_REPOSITORY_HTTPS_URL

我找到了使 SSH 真正工作的替代方法... 如果对您有用,请加分!!!

使用 putty plink 代替 Git ssh(openSSH)

1.set 系统环境变量 GIT_SSH 并让它指向 plink.exe 此处提供下载链接:https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

2.start 选美并添加你的私钥(需要转换成其他格式才能使用)(使用puttygen将id_rsa转换为ppk)

基于 github 或 gitlab 的终端中的

3.use 命令:plink -v git@github.com 或 plink -v git@gitlab.com

恭喜你现在可以使用 ssh

解决方法: 1. 在 Android Studio 中转到 Help - Find Action - Registry... 2.找到git.use.builtin.ssh并启用 3. 检查 git 是否再次工作