How to fix Invocation failed Unexpected Response f

2020-02-02 17:39发布

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 !

5条回答
Explosion°爆炸
2楼-- · 2020-02-02 18:02

This Error seems to appear if your SSH Key Pair is secured with a password

The native SSH Executebale can not prompt you for your password in Android Studio afaik, so authentication will fail if the credentials are not provided otherwise.

Using the Built-in SSH Executable will let you enter your password via a prompt in Android studio.

The Answer provided by Adrian worked perfectly for me.

查看更多
孤傲高冷的网名
3楼-- · 2020-02-02 18:07

I had the same issue. Fixed it by adding SSH private key to the ssh-agent in the command line:

$ ssh-add -K ~/.ssh/id_rsa

Also, check if Git settings are set to Native

Settings --> Version Control --> Git in the SSH executable: dropdown, choose Native

EDIT

It should be fixed in new Android Studio 3.4.2

https://issuetracker.google.com/issues/124680708

查看更多
孤傲高冷的网名
4楼-- · 2020-02-02 18:16

You can try this, don't use the shortcut(git@github.com:/example/example.git) provided by logging in to git, submit directly using the full repo address(https://github.com/example/example.git).

查看更多
Lonely孤独者°
5楼-- · 2020-02-02 18:18

file->setting->git-> SSH executable: dropdown, choose built in

查看更多
Evening l夕情丶
6楼-- · 2020-02-02 18:22

Managed to fix it like this:

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

查看更多
登录 后发表回答