Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

github

ssh

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 [email protected]
Hi slavik81! You've successfully authenticated, but GitHub does not provide shell access.

and

[slavik@localhost guardonce]$ git remote -v
origin  [email protected]:slavik81/guardonce.git (fetch)
origin  [email protected]: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?

like image 204
cgmb Avatar asked Aug 16 '13 04:08

cgmb


People also ask

How do I change my git IP address?

In order to change the URL of a Git remote, you have to use the “git remote set-url” command and specify the name of the remote as well as the new remote URL to be changed. For example, let's say that you want to change the URL of your Git origin remote.

Why git push is not working?

If git push origin master not working , all you need to do is edit that file with your favourite editor and change the URL = setting to your new location. Assuming the new repository is correctly set up and you have your URL right, you'll easily be able to push and pull to and from your new remote location.

How do I change my remote URL?

To change the remote URL for a repository, you'll need to update the configuration file with the new URL. Otherwise, you'll get an error when attempting to push your repository. If you don't want to edit the configuration file, you can also clone the repository from the new location.


2 Answers

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.
like image 91
VonC Avatar answered Sep 20 '22 17:09

VonC


check existing remote url

git config remote.origin.url

if it is not correct you can change it by:

git remote set-url origin [email protected]:slavik81/guardonce.git
like image 42
suhailvs Avatar answered Sep 20 '22 17:09

suhailvs