I changed my MAC address, I believe using sudo ip link set dev interface address XX:XX:XX:XX:XX:XX, in order to be assigned a new local IP address to fix some network issues I was having. This worked perfectly, and my network issues are fixed. However, I'm now having issues with SSH as a result.

If I git pull origin master from a GitHub remote, I get:

Warning: the RSA host key for 'github.com' differs from the key for the IP address ''
Offending key for IP in /home/michael/.ssh/known_hosts:105
Matching host key in /home/michael/.ssh/known_hosts:166
Are you sure you want to continue connecting (yes/no)? yes
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

So not only does it refuse to connect, but also the RSA host key seems to never match the actual host. Even if I ssh-keygen -f "~/.ssh/known_hosts" -R "github.com" and accept the new host key, this error persists.

However, if I change networks from wired (with the spoofed MAC address) to wireless (with the default address), I no longer get this problem.

Is my SSH key tied to my old MAC address? Or is GitHub itself noticing that I changed my MAC address and refusing to let me connect? How can I resolve this?

  • Do you have multiple RSA keys? It could be possible that ssh is trying to use the wrong one. Commented Jan 15, 2020 at 3:35
  • could you attach git log running it with GIT_TRACE=1 git ...? Host key address should not change if you change network anyway. Commented Jan 5, 2021 at 12:42

1 Answer 1


Check if your private key has a line like Private-MAC: xxxxxxxxxxxxxxxx right at the end.

  • 1
    are you sure that has anything to do with the MAC address of the computer, and isn't just a MAC (message authentication code) of the key itself?
    – ilkkachu
    Commented Jan 5, 2021 at 9:57
  • you're right - I was being retarded :) Commented Jan 5, 2021 at 14:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .