others-how to solve Server key did not validate or SSH Auth fail error when using eclipse egit

Problem

When we use eclipse to pull source code from remote repository, sometimes, we get this error:

Server key did not validate

ssh://[email protected]:22/yy: Auth fail

org.eclipse.jgit.api.errors.TransportException

Environment

  • Eclipse

Reason

Eclipse uses egit plugin to pull source code from remote git repository:

image-20201124120724288

EGit is an Eclipse Team provider for the Git version control system. Git is a distributed SCM, which means every developer has a full copy of all history of every revision of the code, making queries against the history very fast and versatile.

The EGit project is implementing Eclipse tooling on top of the JGit Java implementation of Git.

Egit latest release versions:

image-20201124120843382

If you are using old versions of egit plugin, you might get the following errors.

  • Server key did not validate
  • ssh://[email protected]:22/yy: Auth fail
  • org.eclipse.jgit.api.errors.TransportException

Solution

The first step:

Just upgrade to the latest eclipse egit plugin version(5.9.0 until 11.24.2020, you can click this link to get the latest version information).

You can download the latest egit plugin via this method:

  • To install via one of the update site URLs listed below, copy and paste it into the “Help > Install new software” dialog.

EGit can be installed in the following ways:

  • Main Update Site: https://download.eclipse.org/egit/updates (Recommended)
  • Eclipse Releases Update Site: https://download.eclipse.org/releases/latest
  • Via the Eclipse Marketplace

EGit p2 repository ZIP download for system integrators:

In eclipse, please select all option when you upgrade egit plugin online:

image-20201124100809357

The last step:

Restart your eclipse or your computer.