简体   繁体   中英

Setup git over ssh in Rubymine on Windows

I found a lot of threads about how to setup git over ssh with msysgit and putty/plink, but rubymine seems to use its own git and ssh implementation (see error message below).

Currently I have putty, msysgit, TortoiseGit and rubymine installed. My repository has two remotes:

[remote "origin"]
    url = ssh://mygituser@255.255.255.255:1234/path/to/repo.git
[remote "origin_putty"]
    url = putty-alias:path/to/repo.git
    puttykeyfile = path/to/my/putty/keyfile.ppk

In putty the connection "putty-alias" is defined with the same user, host and port used in origin and also sets the ssh key again (might not be necessary). Using TortoiseGit to push to origin_putty works fine since it loads the putty ssh key and prompts for my passphrase. However, when I'm trying to use origin from rubymine it prompts for the password of mygituser since there is no keyfile defined.

I already tried the following solutions

  • Setting GIT_SSH to plink, running pageant and loading the key there (no change)
  • using the puttykeyfile line in the definition of origin (no change)
  • using origin_putty from rubymine (does not resolve putty-alias )

The reason I think rubymine uses its own ssh implementation is the error message I get on an unsuccessful authentication: SSH: authentication methods: [publickey, keyboard-interactive, password] last successful method:

java.io.IOException: Authentication failed: 
    at org.jetbrains.git4idea.ssh.SSHMain.authenticate(SSHMain.java:280)
    at org.jetbrains.git4idea.ssh.SSHMain.start(SSHMain.java:155)
    at org.jetbrains.git4idea.ssh.SSHMain.main(SSHMain.java:135)
fatal: The remote end hung up unexpectedly

You're right: by default RubyMine uses trilead-ssh2 Java library, and is not aware about Putty settings.

You may switch to using the native SSH in the Settings | Version Control | Git | SSH Executable | Native But note, that it doesn't work well with passphrases, so if your private key is passphrase protected, you have to use pageant or similar software.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM