Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Push/pull to Github is broken in Android Studio and IntelliJ

I have SSH set up to authenticate with Github from both Android Studio (3.0.1 - Build #AI-171.4443003) and IntelliJ (2017.3.4 - Build 173.4548.28) and everything was working fine up until yesterday (February 22, 2018).

All of a sudden today (February 23, 2018) when I tried to push or pull anything to/from Github in either IntelliJ or Android Studio it fails, and I get this message in the "Version Control Console":

16:41:14.159: [onebusaway-android] git -c core.quotepath=false pull --progress --no-stat -v --progress upstream master
java.io.IOException: There was a problem while connecting to github.com:22
        at com.trilead.ssh2.Connection.connect(Connection.java:791)
        at com.trilead.ssh2.Connection.connect(Connection.java:577)
        at org.jetbrains.git4idea.ssh.SSHMain.start(SSHMain.java:172)
        at org.jetbrains.git4idea.ssh.SSHMain.main(SSHMain.java:138)
Caused by: java.io.IOException: Key exchange was not finished, connection is closed.
        at com.trilead.ssh2.transport.KexManager.getOrWaitForConnectionInfo(KexManager.java:92)
        at com.trilead.ssh2.transport.TransportManager.getConnectionInfo(TransportManager.java:230)
        at com.trilead.ssh2.Connection.connect(Connection.java:743)
        ... 3 more
Caused by: java.io.IOException: Cannot negotiate, proposals do not match.
        at com.trilead.ssh2.transport.KexManager.handleMessage(KexManager.java:413)
        at com.trilead.ssh2.transport.TransportManager.receiveLoop(TransportManager.java:754)
        at com.trilead.ssh2.transport.TransportManager$1.run(TransportManager.java:469)
        at java.lang.Thread.run(Thread.java:745)
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

This happened at the same time on two different machines, one with Windows 7 Enterprise and the other with Windows 10.

Why did this suddenly stop working, and how can I fix it?

like image 257
Sean Barbeau Avatar asked Feb 23 '18 21:02

Sean Barbeau


2 Answers

IntelliJ encountered a problem with the github push, pull from February 23, 2018. The reason is that the weak cryptographic of Built-in SSH in IntelliJ is no longer supported by github.

The solution is simple, without upgrading IntelliJ.

[IntelliJ - File - Settings - Version Controll - Git] 

You can change 'SSH executable' from 'Build-in' to 'Native'.

enter image description here

Since 'Native' uses git.exe, there is no problem because most of the git clients already have the latest cryptographic applied. If you are using an old git client, please update!

https://git-scm.com/download

ps) IntelliJ, PhpStorm, and Android Studio all have the same problem and can be resolved in the same way.

background) Sean Barbeau's answer.

like image 86
Been Kyung-yoon Avatar answered Oct 31 '22 20:10

Been Kyung-yoon


Solution:

For IntelliJ - Update to IntelliJ 2018.1 or 2017.3.5 (173.4674.1).

For Android Studio - Update to Android Studio 3.1 see this comment on issue tracker.

Background:

Github triggered this on February 23, 2018 by permanently removing support for weak cryptographic standards:

https://github.com/blog/2507-weak-cryptographic-standards-removed

However, IntelliJ and Android Studio still have issues with some SSH handshakes using strong security ciphers:

  • IntelliJ issue - https://youtrack.jetbrains.com/issue/IDEA-140196
  • Android Studio issue - https://issuetracker.google.com/issues/73804233

This underlying issue has been fixed in IntelliJ 2018.1: https://youtrack.jetbrains.com/issue/IDEA-140196#comment=27-2717976

...as well as 2017.3.5 (173.4674.1).

For Android Studio, the fix is available in Studio 3.1 see this comment on issue tracker.

As @Been Kyung Yoon mentions in his answer as a workaround you can change the SSH executable to "Native", but as mentioned in the IntelliJ issue note that:

Switching to Native will work, but if your keys are passphrase-protected, you will need to load them into ssh-agent first

like image 37
Sean Barbeau Avatar answered Oct 31 '22 20:10

Sean Barbeau