繁体   English   中英

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

[英]Push to remote on GitHub pointed to a new server IP instead

我不知道发生了什么变化,但是当我试图在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 那么,为什么不呢?

现在(2013年8月25日)在“ IP地址变更 ”中解释了变化

我们在4月份提到了这些新地址并更新了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.

检查现有的远程URL

git config remote.origin.url

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

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

它是加利福尼亚州的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攻击,所以他们可能会这样做以帮助对抗它。

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。 您可以在此处进行更改。

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

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

$ rm -rf deploy_dir/shared/cached-copy

然后再次部署。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM