Eclipse Egit Cannot Log Into Bitbucket

Viewed 2773

All was working fine until I let automatic updates run in Spring Tool Suite (Eclipse). One of the updates was to Egit. Now, when I try to pull a repository or interact with any of the team functions, I get the following error:

git@bitbucket.org:my-company/my-repo.git: Cannot log in at bitbucket.org:22

I've tried every other solution I can think of and find online, including reverting to my previous configuration before the update, but nothing seems to work. Does anyone have any suggestions as to what the problem might be?

3 Answers

Seems to be a known issue with the recent EGit release in eclipse 2021-03

Known affected git servers: bitbucket.org, AWS Code Commit, Azure DevOps

Work-arounds:

  • Install EGit nightly, or
  • Use an ed25519 key, or an ECDSA key, or
  • Use an external SSH via environment variable GIT_SSH.

I use the last

$ GIT_SSH=/usr/bin/ssh eclipse

It's probably problem with Eclipse EGit plugin v. 5.11. It is solved in the May nightly build of the plugin. You have to install it, because it is the last version at present time. In Spring Tool Studio (Eclipse) I had to do "Help / Check for updates" in addition to the instructions.

The reasons why such an error massage could rise are:

  • your ssh-key got overwritten during generation of a new one and overwriting the previous file (generally it is /home/user/.ssh/id_rsa)
  • a passphrase secured ssh key got accessed by entering a wrong passphrase 3 times
  • a new key was generated by a silent tooling and the previous one got removed
  • an eclipse update or plugin update threw out the SSH2 key config from eclipse
  • there might be other reasons

In either case it is recommended that you create a new ssh key via the ssh-keygen command line tool. It increases security beside solving your problem with eclipse. You can skip the passphrase generation by heading over with [Enter] on both questions.

After you created a new key, you should import it into bitbucket (not Bigbucket). You can remove the previous one from your profile since it went invalid anyway. And of course you use different keys on different machines for security reasons, don't you?

On the command line you should be able to work now. Try it with git fetch or git pull

To even make it work in eclipse egit you need to add the private key to the SSH2 private keys list. It can be found under

Windows > Preferences > General > Network Connection > SSH2 > General

Just use the Add Private Key... button. The file usually is called like id_rsa with no extension or it carries a user specified name.

Adding the private key worked without a restart in my case.

Related