# Slightly embarassing bug in error message when RSA key doesn't match.

2 messages from 2024-01-25 to 2024-01-25. Participants: Peter da Silva, Jeff King.
Thread: https://gitlist.dev/t/60791

## Peter da Silva, 2024-01-25 16:37

Subject: Slightly embarassing bug in error message when RSA key doesn't match.
Message-ID: <CAMbH6s90tNo1Kz3xuv741LoUkN=Y3Bcw2=7yGQhEe=xrgBgQcw@mail.gmail.com>
URL: https://gitlist.dev/e/CAMbH6s90tNo1Kz3xuv741LoUkN%3DY3Bcw2%3D7yGQhEe%3DxrgBgQcw%40mail.gmail.com

```
git version 2.20.1

I just went to clone a repo on github on a dev server that I hadn't
used since March 1 2023.

Github updated their RSA key on March 24th.

So I got this message.

Warning: the ECDSA host key for 'github.com' differs from the key for
the IP address '140.82.113.3'
Offending key for IP in /[...]/.ssh/known_hosts:8
Matching host key in /[...]/.ssh/known_hosts:18

Of course it was the RSA key that had changed, and known_hosts:8 was
an RSA key, but the error said the ECDSA key was wrong. After removing
the bogus RSA key from the file it worked fine with the matching ECDSA
key. This error should probably report the correct type for the key
that is wrong rather than the key it’s trying to use. :)

```

## Jeff King, 2024-01-25 18:12

Subject: Re: Slightly embarassing bug in error message when RSA key doesn't match.
Message-ID: <20240125181218.GB54488@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20240125181218.GB54488%40coredump.intra.peff.net
In-Reply-To: <CAMbH6s90tNo1Kz3xuv741LoUkN=Y3Bcw2=7yGQhEe=xrgBgQcw@mail.gmail.com>

```
On Thu, Jan 25, 2024 at 10:37:15AM -0600, Peter da Silva wrote:

> Warning: the ECDSA host key for 'github.com' differs from the key for
> the IP address '140.82.113.3'
> Offending key for IP in /[...]/.ssh/known_hosts:8
> Matching host key in /[...]/.ssh/known_hosts:18
> 
> Of course it was the RSA key that had changed, and known_hosts:8 was
> an RSA key, but the error said the ECDSA key was wrong. After removing
> the bogus RSA key from the file it worked fine with the matching ECDSA
> key. This error should probably report the correct type for the key
> that is wrong rather than the key it’s trying to use. :)

This comes from your ssh client, not Git itself (of course Git is
calling the ssh client under the hood, but we can't fix their messages).

-Peff

```
