Push to remote on GitHub pointed to a new server IP instead

git, github, ssh

Solution

What has changed is now (August 25th, 2013) explained in "IP Address Changes":

We mentioned these new addresses back in April and updated the Meta API to reflect them. Some GitHub services have have already been migrated to the new addresses, including:

api.github.com
gist.github.com
ssh.github.com

Our next step is to begin using these IP addresses for the main GitHub site, so we're reminding everyone about this change. There are a few gotchas that might affect some people:

If you have explicit firewall rules in place that allow access to GitHub from your network, you'll want to make sure that all of the IP ranges listed in this article are included.

If you have an entry in your `/etc/hosts` file that points `github.com` at a specific IP address, you should remove it and instead rely on DNS to give you the most accurate set of addresses.

If you are accessing your repositories over the SSH protocol, you will receive a warning message each time your client connects to a new IP address for `github.com`. As long as the IP address from the warning is in the range of IP addresses in the previously mentioned Help page, you shouldn't be concerned. Specifically, the new addresses that are being added this time are in the range from 192.30.252.0 to 192.30.255.255. The warning message looks like this:

Warning: Permanently added the RSA host key for IP address '$IP' to the list of known hosts.

Problem

I've no idea what changed, but I was in for a big surprise when I tried to push to my remote on GitHub and it went to a completely unknown IP instead. ``` [slavik@localhost guardonce]$ git push origin master Warning: Permanently added the RSA host key for IP address '192.30.252.128' to the list of known hosts. Connection closed by 192.30.252.128 fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. ``` Other tests suggest that my local machine's configuration is fine. For example: ``` [slavik@localhost guardonce]$ ssh -T git@github.com Hi slavik81! You've successfully authenticated, but GitHub does not provide shell access. ``` and ``` [slavik@localhost guardonce]$ git remote -v origin git@github.com:slavik81/guardonce.git (fetch) origin git@github.com:slavik81/guardonce.git (push) ``` Looking at my known_hosts, I expected to be speaking to `github.com,204.232.175.90`. So, why aren't I?

Original source