git Push failed: Failed with error: ssh 变体“simple”不支持设置端口

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/48415042/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 13:02:55  来源:igfitidea点击:

git Push failed: Failed with error: ssh variant 'simple' does not support setting port

gitintellij-ideassh

提问by TheKojuEffect

My git remote origin uses ssh url with port specified. I am getting an error while pushing using IntelliJ.

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

Push failed: Failed with error: ssh variant 'simple' does not support setting port

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

I encountered this error after upgrading to latest git 2.16.1

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

Push failed: Failed with error: ssh variant 'simple' does not support setting port

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

回答by TheKojuEffect

From https://confluence.atlassian.com/bamkb/unable-to-detect-latest-git-changes-ssh-variant-simple-does-not-support-setting-port-943532118.html, it seems like git 2.16 doesn't work with SSH executable bundled with IntelliJ 2017.3.

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.

Changing IntelliJ configuration to use "SSH Executable -> Native" fixed this issue.

将 IntelliJ 配置更改为使用“SSH Executable -> Native”修复了这个问题。

Git Executable to Native

Git 可执行到本机

回答by fanky10

I got it solved with setting

我通过设置解决了

git config --global ssh.variant ssh

git config --global ssh.variant ssh

No need to change anything in Android Studio 3.1

无需在 Android Studio 3.1 中更改任何内容

回答by Denis Udod

Applies to:

适用于:

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


1) IntelliJ IDEA remove port number from your remote

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

before: | origin | ssh://[email protected]:24567/ABC/my.project/project|

之前: | 产地| ssh://[email protected]:24567/ABC/my.project/project|

after: | origin | ssh://[email protected]/ABC/my.project/project|

之后: | 产地| ssh://[email protected]/ABC/my.project/project|

2) IntelliJ IDEA leave SSH executable as "Build-in"

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

3) create ssh config file ~/.ssh/config

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

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

more details about config see: https://www.ssh.com/ssh/config/

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

4) restart IntelliJ IDEA

4)重启IntelliJ IDEA

回答by sonavolob

Applies to:

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

适用于

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

Solution in my case - remove port number from your remote(VCS -> Git -> Remotes), leave Native for SSH executable (File -> Settings -> Version Control -> Git -> SSH executable -> Native).

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

before: ssh://[email protected]:22/home/git/projects/android/project.git

after: ssh://[email protected]/home/git/projects/android/project.git}

回答by Alexander Poleschuk

I had this problem in Android Studio 3.1

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

I changed Preferences > Version Control > Git > SSH executablefrom Built-into Nativeas suggested here but it didn't help.

我按照此处的建议将首选项 > 版本控制 > Git > SSH 可执行文件内置更改为本,但没有帮助。

Then I upgraded Android Studio to 3.2 and switched back to Built-in. It fixed the issue in my case.

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