GitHub Push failed in Android Studio 3.4.1

Viewed 3426

Android Studio 3.4.1 Windows 10 git 2.22.0

Craete pub key from Git Gui. Share key in my git account.

I geting errors when I try in Android Studio VCS->Git->Push

Native

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

Built-in

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.
2 Answers

I just had the same issue. What fixed it for me going to Settings>Git and enabling "use credential helper".

You should first create repo in github from android studio, or import your project into the repo if it already exists(looks like you have the repo already so you might want to simply import your project) before you are able to commit/push/pull etc. I will attach a screenshot here to illustrate. It is very straight forward.enter image description here

Related