今天在git push东西的时候发现超时了,找了好多办法也解决不了,后面发现配置一下hosts就行了,所以分享一下,首先找到github有用的ip:
访问网址:http://ping.chinaz.com/github.com
找到一个可用的ip:
然后填入hosts里:
sudo vim /etc/hosts
添加一行
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
52.74.223.119 github.com
保存退出:
:wq
本地ping一下:
? Frequent-use git:(master) ping github.com
PING github.com (52.74.223.119): 56 data bytes
64 bytes from 52.74.223.119: icmp_seq=0 ttl=37 time=223.711 ms
64 bytes from 52.74.223.119: icmp_seq=1 ttl=37 time=224.997 ms
^C
--- github.com ping statistics ---
3 packets transmitted, 2 packets received, 33.3% packet loss
round-trip min/avg/max/stddev = 223.711/224.354/224.997/0.643 ms
发现能ping通就可以使用了哈。
参考文献
Failed to connect to github.com port 443 Timed out
|