在GitHub上推送到远程指向新服务器IP

时间:2013-08-16 04:34:44

标签: git github ssh

我不知道发生了什么变化,但当我试图在GitHub上推送到我的遥控器时,我感到非常惊讶,而它却转向了一个完全未知的IP。

[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.

其他测试表明我的本地机器的配置很好。例如:

[slavik@localhost guardonce]$ ssh -T git@github.com
Hi slavik81! You've successfully authenticated, but GitHub does not provide shell access.

[slavik@localhost guardonce]$ git remote -v
origin  git@github.com:slavik81/guardonce.git (fetch)
origin  git@github.com:slavik81/guardonce.git (push)

看着我的known_hosts,我期待与github.com,204.232.175.90对话。那么,为什么不是我?

5 个答案:

答案 0 :(得分:15)

现在(2013年8月25日)在“IP Address Changes”中解释了什么:

  

我们提到了这些新地址back in April并更新了Meta API以反映这些地址   一些GitHub服务已经迁移到新地址,包括:

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

我们的下一步是开始在主GitHub网站上使用这些IP地址,因此我们提醒所有人注意这一变化。
  有一些问题可能会影响某些人:

     
      
  • 如果您有明确的防火墙规则允许从您的网络访问GitHub,您需要确保包含本文中列出的所有IP范围。

  •   
  • 如果您的/etc/hosts文件中有一个条目github.com指向某个特定的IP地址,则应将其删除,而是依靠DNS为您提供最准确的地址集

  •   
  • 如果您通过SSH协议访问存储库,则每次客户端连接到github.com的新IP地址时,您都会收到一条警告消息。
      只要警告中的IP地址在前面提到的帮助页面中的IP地址范围内,就不应该担心。
      具体来说,此次添加的新地址范围为192.30.252.0到192.30.255.255。   警告消息如下所示:

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

答案 1 :(得分:2)

检查现有的远程网址

git config remote.origin.url

如果不正确,您可以通过以下方式进行更改:

git remote set-url origin git@github.com:slavik81/guardonce.git

答案 2 :(得分:1)

这是加州的github服务器

$ git config remote.origin.url
git@github.com:blah/foo
$ ping github.com
PING github.com (192.30.252.128) 56(84) bytes of data.
64 bytes from 192.30.252.128: icmp_seq=1 ttl=47 time=63.6 ms

http://en.utrace.de/ip-address/192.30.252.128

编辑: 他们在最近几天遭受了严重的DDoS攻击,所以他们可能会这样做以帮助对抗它。

答案 3 :(得分:0)

git push的url列在config文件夹中。在您的应用程序中查找.git文件夹,然后在其中打开配置文件。

$ cat config 

[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] fetch = +refs/heads/*:refs/remotes/origin/* url = git@github.com:******/******.git [branch "master"] remote = origin merge = refs/heads/master [branch "sprint_1"] remote = origin merge = refs/heads/sprint_1

检查远程“origin”的url,它显示远程的当前url。你可以在这里进行更改。

答案 4 :(得分:0)

如果您使用capistrano gem进行部署,则会在服务器上的deploy_dir/shared/cached-copy中克隆回购。

只需删除deploy_dir/shared/cached-copy目录。

$ rm -rf deploy_dir/shared/cached-copy

然后再次部署。