How to fix Invocation failed Unexpected Response from Server: Unauthorized in Android studio

Jake warton picture Jake warton · Apr 21, 2019 · Viewed 9.9k times · Source

I have one project on Gitlab and I worked with it for the last few days!

Now i want pull project on my home PC but show me below error :

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)

My android studio version is 3.4 !

Answer

Adrian Coman picture Adrian Coman · Apr 23, 2019

Managed to fix it like this:

AndroidStudio -> Preferences -> Git -> SSH Executable and changed from Native to Built-in and it started working.

Edit: this is for Android Studio 3.4, for 3.6 Volodymyr has an answer below.