开发者

Egit Refuses to accept id_rsa

I'm a first time git user trying to setup egit in Eclipse so I can continue to easily code through Eclipse. Problem is, every time I try to clone a repo t开发者_StackOverflow中文版hrough egit, it gives me the error "Cannot list available branches. Reason: ssh://git@github.com:22 Passphrase for /Users/elifinkelshteyn/.ssh/id_rsa." This is really strange as I can clone through terminal using that same id_rsa just fine, and I've verified in Eclipse ssh properties that it is trying to use the correct key. What gives?


if you get a prompt for the passphrase but eclipse doesn't accept the passphrase, try the following:

set the GIT_SSH environment variable to your ssh client e.g. by adding

export GIT_SSH=/usr/bin/ssh

to your .bash_rc

on Mac OSX, open terminal and type:

cd
mkdir .MacOSX
cd .MacOSX
echo "" > environment.plist
open environment.plist

add a KEY=GIT_SSH with VALUE=/usr/bin/ssh and save the file.

After relogin to your account, it should work.


Just to confirm: this is a current bug (issue 353561).
And passphrase might still be a problem depending on the encryption you used when creating your key (bug 326526).

However, passphrase are supposed to be supported (as the Egit user guide mentions).


As VonC says, it's a bug that the SSH implementation that EGit uses can't handle anything but 3DES encrypted private keys. If you're like me, you have AES encrypted keys, so it just fails to decrypt them. There is a comment in that bug report, here's a link directly to the comment https://bugs.eclipse.org/bugs/show_bug.cgi?id=326526#c9

That comment provided a working workaround: recent versions of EGit honour the GIT_SSH environment variable, setting that to /usr/bin/ssh or even plink.exe if you're on windows should solve the issue.


A considerable amount of time has passed since the OP and I still had the same problem. For those who still has this problem, this might help:

Make sure you did setup a push remote. It worked for me when I got both the Cannot get remote repository refs-problems ("... Passphrase for..." and "Auth fail" in the "Push..." dialog).

Provided that you already:

  1. Setup your SSH keys with Github (Window > Preferences > General > Network Connections > SSH2)

  2. Setup your local repository (you can follow this guide for that)

  3. Created a Github repository (same guide)

... here's how you do it:

  • Go to the Git Repositories view (Window > Show View > Other > Git Repositories)
  • Expand your Repository and right click Remotes --> "Create Remote"
  • "Remote Name": origin, "Configure push": checked --> click "OK"
  • Click the "Change..." button
  • Paste your git URI and select protocol ssh --> click "Finish"
  • Now, click "Save and Push" and NOW you should get a password prompt --> enter the public key passphrase here (provided that you DID (and you should) setup a passphrase to your public key) --> click "OK"
  • Now you should get a confirmation window saying "Pushed to YourRepository - origin" --> click "OK"
  • Push to upstream, but this time use "Configured remote repository" as your Destination Git repository
  • Go get yourself a well earned cup of coffee!


It looks like your /Users/elifinkelshteyn/.ssh/id_rsa file requires a password, and I'm not sure that the ssh implementation in Eclipse knows how to prompt you for one. It's tickling the back of my brain that there's probably an ssh-auth package you need to install for the mac so that it can prompt, and if you can find out more about that, it's probably ideal. However, a workaround in the short term is to generate a new rsa key that doesn't use a password, upload that to github, and set eclipse to use it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜