在Android Studio和IntelliJ中,推/拉到Github已被破坏

Sea*_*eau 22 git ssh github intellij-idea android-studio

我已经设置了SSH来设置从Android Studio(3.0.1 - Build#AI-171.4443003)和IntelliJ(2017.3.4 - Build 173.4548.28)的Github进行身份验证,一切正常,直到昨天(2018年2月22日) .

突然今天(2018年2月23日)当我试图在IntelliJ或Android Studio中向Github推送任何东西时,它失败了,我在"版本控制台"中收到了这条消息:

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.
Run Code Online (Sandbox Code Playgroud)

这在两台不同的机器上同时发生,一台使用Windows 7 Enterprise,另一台使用Windows 10.

为什么突然停止工作,我该如何解决?

Bee*_*oon 26

IntelliJ遇到了github push, pull来自的问题February 23, 2018.原因是Built-in SSHgithub不再支持IntelliJ 中的弱加密.

解决方案很简单,无需升级IntelliJ.

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

You can change 'SSH executable' from 'Build-in' to 'Native'.
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

由于'Native'使用git.exe,因此没有问题,因为大多数git客户端已经应用了最新的加密.如果您使用的是旧的git客户端,请更新!

https://git-scm.com/download

ps)IntelliJ,PhpStorm和Android Studio都有相同的问题,可以用同样的方式解决.

背景)Sean Barbeau的回答.

  • 如IntelliJ问题中所述,请注意"切换到本机将起作用,但如果您的密钥受密码保护,则需要先将它们加载到ssh-agent中". (3认同)

Sea*_*eau 9

解:

对于IntelliJ - 更新到IntelliJ 2018.1或2017.3.5(173.4674.1).

对于Android Studio - 更新到Android Studio 3.1,请在问题跟踪器上查看此评论.

背景:

Github在2018年2月23日通过永久删除对弱加密标准的支持来触发这一点:

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

但是,IntelliJ和Android Studio仍然存在一些使用强安全密码的SSH握手问题:

这个基本问题已在IntelliJ 2018.1中修复:https://youtrack.jetbrains.com/issue/IDEA-140196#comment=27-2717976

......以及2017.3.5(173.4674.1).

对于Android Studio,修补程序在Studio 3.1中可用,请在问题跟踪器上查看此评论.

正如@Been Kyung Yoon在他的回答中提到的那样,你可以将SSH可执行文件更改为"Native",但正如IntelliJ问题中提到的那样:

切换到Native将起作用,但如果您的密钥受密码保护,则需要先将它们加载到ssh-agent中