解决github连接超时问题(ubuntu下)

在这里转载其他网友的:https://www.cnblogs.com/long5683/p/14818825.html

1.确定是否能打开github

ping github.com

 2.修改hosts文件

sudo gedit /etc/hosts

将以下内容添加到hosts文件中


127.0.0.1	localhost                    
127.0.1.1	Leopard-10SFR   #用户名不同电脑不一样

#由于ubuntu安全问题,需追加这两条指令
10.181.255.21 github.com git   10.181.255.21是本级ipv4/ipv6地址 
20.205.243.166 github.com       20.205.243.166是利用站长工具,获取的github数据库ip地址

#github.com
199.232.69.194 github.global.ssl.fastly.net #这是github域名ip地址
185.199.108.153 assets-cdn.github.com       #这下面都是github静态资源ip
185.199.109.153 assets-cdn.github.com
185.199.110.153 assets-cdn.github.com
185.199.111.153 assets-cdn.github.com

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

保存hosts文件即可访问

TIPS:

获取本级ip地址/github网站地址 :百度搜索ip查询工具即可

都不行的话,直接用这个连接的方法:Ubuntu解决Github无法访问的问题-腾讯云开发者社区-腾讯云

  • 4
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值