18

I've cloned an existing git repository. Git is working fine when I pull using command line. However, when I try doing the same from Intellij, it says

Fetch failed. Fatal : Could not read from remote repository.

VCS console log shows:

git fetch --progress --prune origin
java.lang.RuntimeException: Invocation failed Server returned invalid Response.
    at org.jetbrains.git4idea.ssh.GitSSHXmlRpcClient.askPassword(GitSSHXmlRpcClient.java:176)
    at org.jetbrains.git4idea.ssh.SSHMain.authenticate(SSHMain.java:265)
    at org.jetbrains.git4idea.ssh.SSHMain.start(SSHMain.java:157)
    at org.jetbrains.git4idea.ssh.SSHMain.main(SSHMain.java:137)
Caused by: java.io.IOException: Server returned invalid Response.
    at org.apache.xmlrpc.LiteXmlRpcTransport.sendRequest(LiteXmlRpcTransport.java:243)
    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.ssh.GitSSHXmlRpcClient.askPassword(GitSSHXmlRpcClient.java:170)
    ... 3 more
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

I'm using ssh key pair for authentication. I'd appreciate any help on this.

mindreader
  • 1,077
  • 3
  • 9
  • 19
  • Is there any section in IntelliJ itself for adding/registering a SSH key? – saiarcot895 Mar 19 '14 at 23:44
  • It does give an option to choose ssh executable between native and built-in. Is that what you are referring to? – mindreader Mar 19 '14 at 23:47
  • And changing it to native helped. I've always used the built-in option for windows but for ubuntu, it seems, native it is. – mindreader Mar 19 '14 at 23:49
  • Ah, ok. A basic (possibly inaccurate) explanation is that when you run `git` from Terminal, it knows in which directory the SSH keys are located in (or it just calls `ssh` to get the keys). The built-in SSH tool doesn't know where your keys are located. – saiarcot895 Mar 19 '14 at 23:50
  • That makes sense. I wonder how does it work in windows. Btw, thanks for your help :) – mindreader Mar 19 '14 at 23:56

1 Answers1

38

For IntelliJ 13/14,

  1. Click File-> Settings. Keyboard shortcut is Ctrl+Alt+S.
  2. Search for "Version Control"
  3. Choose "Git" under "version Control"
  4. In the SSH executable dropdown, choose Native
dedunu
  • 8,986
  • 4
  • 22
  • 28
mindreader
  • 1,077
  • 3
  • 9
  • 19
  • 2
    This also works for my colleague who has the same problem on Win7 Pro, but it is a workaround, not a solution. Do you have any idea why it worked in IDEA 13.0, but not in 13.1 anymore? On my machine (also Win7 Pro, IDEA 13.1.1 Ultimate) it works nicely with the integrated SSH. – kriegaex Apr 07 '14 at 12:21
  • 8
    This didn't work for me.. – AO_ Aug 21 '14 at 14:46
  • f00644 - it must work if it works for you on commandline. – Erik Kaju Nov 04 '14 at 08:14
  • Works for PhpStorm as well – luukvhoudt May 01 '16 at 14:31
  • Works for PyCharm as well. – törzsmókus May 17 '17 at 15:20
  • Thanks, this worked in WebStorm for me on Ubuntu 16.04. One day I just started getting `"Key exchange was not finished, connection is closed."` and `"Cannot negotiate, proposals do not match."` and changing to native worked, because `git pull` in terminal worked. – Benno Feb 22 '18 at 23:09