【问题标题】:git Push failed: Failed with error: ssh variant 'simple' does not support setting portgit Push 失败:失败并出现错误:ssh 变体“简单”不支持设置端口
【发布时间】:2018-10-25 20:58:54
【问题描述】:

我的 git 远程源使用指定端口的 ssh url。使用 IntelliJ 推送时出现错误。

推送失败:失败并出现错误:ssh 变体“简单”不支持设置端口

升级到最新的 git 2.16.1 后遇到这个错误

【问题讨论】:

    标签: git intellij-idea ssh


    【解决方案1】:

    来自https://confluence.atlassian.com/bamkb/unable-to-detect-latest-git-changes-ssh-variant-simple-does-not-support-setting-port-943532118.html,似乎 git 2.16 不适用于与 IntelliJ 2017.3 捆绑的 SSH 可执行文件。

    Git version 2.16.0-rc0 does not work well with OpenSSH version 6.7 or older as stated in this bug report.
    

    将 IntelliJ 配置更改为使用“SSH 可执行文件 -> 本机”修复了此问题。

    【讨论】:

    • 适用于以下 IntelliJ 版本:IntelliJ IDEA 2017.1.3 Build #IU-171.4424.56, built on May 12, 2017
    • 这在我的情况下不起作用(对于 Android Studio 3.1)。请在下面查看我的答案。
    【解决方案2】:

    我通过设置解决了它

    git config --global ssh.variant ssh

    无需在 Android Studio 3.1 中进行任何更改

    【讨论】:

    • 在 Debian 9 和 PyCharm 2017.3.6 上为我工作
    【解决方案3】:

    适用于:

    • Windows 7
    • IntelliJ Idea 2017.3.4 Build UI-173.4548.28 build 于 2018 年 1 月 29 日
    • git 版本 2.16.2.windows.1
    • ssh -V OpenSSH_7.6p1,OpenSSL 1.0.2n 2017 年 12 月 7 日

    1) IntelliJ IDEA 从您的遥控器中删除端口号

    之前: |产地 | ssh://myusername@git.mycompany.com:24567/ABC/my.project/project|

    之后: |产地 | ssh://myusername@git.mycompany.com/ABC/my.project/project|

    2) IntelliJ IDEA 将 SSH 可执行文件保留为“内置”

    3) 创建 ssh 配置文件 ~/.ssh/config

    Host git.mycompany.com
      HostName git.mycompany.com
      Port 24567
      User myusername
    

    有关配置的更多详细信息,请参阅:https://www.ssh.com/ssh/config/

    4) 重启 IntelliJ IDEA

    【讨论】:

      【解决方案4】:

      适用于

      • Win10 64位
      • Android Studio 3.0.1,BUILD #AI-171.4443003
      • Git 2.16.0.windows.2

      在我的情况下的解决方案 - 从远程删除端口号(VCS -> Git -> Remotes),将 Native 保留为 SSH 可执行文件(文件 -> 设置 -> 版本控制 -> Git -> SSH 可执行文件 -> 本机)。

      before: ssh://git@192.168.2.46:22/home/git/projects/android/project.git
      
      after: ssh://git@192.168.2.46/home/git/projects/android/project.git}
      

      【讨论】:

        【解决方案5】:

        我在 Android Studio 3.1 中遇到过这个问题

        我按照此处的建议将 Preferences > Version Control > Git > SSH executableBuilt-in 更改为 Native 但这没有帮助.

        然后我将 Android Studio 升级到 3.2 并切换回 Built-in。它解决了我的问题。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2015-07-17
          • 2018-12-01
          • 1970-01-01
          • 1970-01-01
          • 2014-09-18
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多