Android Studio 3.4.1中GitHub推送失败

4

Android Studio 3.4.1

Windows 10

git 2.22.0

使用 Git Gui 创建公钥。 在我的 git 账户中共享密钥。

当我尝试在 Android Studio 中使用 VCS->Git->Push 时,出现错误。

本机。

Push 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(GitNativeSshAskPassXmlRpcClient

内置
Push failed
            Java.io.IOException: Authentication failed:
            at org.jetbrains.git4idea.ssh.SSHMain.authenticate(SSHMain.java:288)
            at org.jetbrains.git4idea.ssh.SSHMain.start(SSHMain.java:162)
            at org.jetbrains.git4idea.ssh.SSHMain.main(SSHMain.java:125)
            Caused by: java.io.IOException: Publickey authentication failed.
            at com.trilead.ssh2.auth.AuthenticationManager.authenticatePublicKey(AuthenticationManager.java:291)
            at com.trilead.ssh2.Connection.authenticateWithPublicKey(Connection.java:483)
            at org.jetbrains.git4idea.ssh.SSHMain.tryPublicKey(SSHMain.java:341)
            at org.jetbrains.git4idea.ssh.SSHMain.authenticate(SSHMain.java:221)
            ... 2 more
            Caused by: java.io.IOException: PEM problem: it is of unknown type
            at com.trilead.ssh2.crypto.PEMDecoder.decodeKeyPair(PEMDecoder.java:500)
            at com.trilead.ssh2.auth.AuthenticationManager.authenticatePublicKey(AuthenticationManager.java:225)
            ... 5 more
            Could not read from remote repository.
            Please make sure you have the correct access rights
            and the repository exists.

这不是Android Studio,而是你的密钥无效。也许你漏掉了一个字母或其他什么。这是身份验证失败。 - The_Martian
然而,我的密钥在Git GUI应用程序中可以使用,但在Android Studio中却不行。在BitBucket上一切正常。 - Иван Тулаев
然而,我的密钥在Git GUI应用程序中有效,但在Android Studio中无效。在BitBucket上一切正常。现在不需要与GitHub集成))) - Иван Тулаев
2个回答

9

我遇到了同样的问题。对我有用的解决方法是前往“设置>Git”,并启用“使用凭据助手”。


2
它已经工作了.... - sasikumar
1
这是一个“英雄”答案! - Jay Halani

0

在进行提交/推送/拉取等操作之前,你应该首先在 Github 中从 Android Studio 中创建 repo 或将你的项目导入到已存在的 repo 中(看起来你已经有了 repo,所以你可能只需要导入项目)。我会在这里附上一个截图来说明。非常简单明了。enter image description here


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接