社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Git

国内用户GitHub访问速度慢怎么办?一招解决!

21ic电子网 • 3 年前 • 866 次点击  

GitHub

作为全球最大的同性交友网站,GitHub可谓是又爱又恨,爱的是太多非常棒的开源项目了,有很大的参考价值,也方便我们自己托管项目,恨的是这个网站的访问实在是太不给力了,基本是随缘了,不同城市不同网络都各不相同,用宽带,手机流量也各不相同,大部分是不怎么好的。
最近发现一个叫做Fetch Github Hosts的项目,也许能帮到大家,这里只针对网络不好的同学哈,fetch-github-hosts是主要为解决研究及学习人员访问Github过慢或其他问题而提供的免费的Github hosts同步服务,项目开源,有写具体的使用方法,有需要的同学可以前往学习一下。

简单粗暴的方法

手动添加hosts
访问https://hosts.gitcdn.top/hosts.txt这个网站,将网页的全部内容粘贴到你的hosts文件中

Linux / MacOS hosts路径:/etc/hostsWindows hosts路径:C:\Windows\System32\drivers\etc\host

这里也顺便贴出来,大家复制即可:

# fetch-github-hosts begin140.82.112.26               alive.github.com140.82.112.26               live.github.com185.199.108.154             github.githubassets.com140.82.112.21               central.github.com185.199.111.133             desktop.githubusercontent.com185.199.109.153             assets-cdn.github.com185.199.108.133             camo.githubusercontent.com185.199.108.133             github.map.fastly.net146.75.113.194              github.global.ssl.fastly.net52.192.72.89                gist.github.com185.199.108.153             github.io52.192.72.89                github.com192.0.66.2                  github.blog52.69.239.207               api.github.com185.199.109.133             raw.githubusercontent.com185.199.109.133             user-images.githubusercontent.com185.199.111.133             favicons.githubusercontent.com185.199.109.133             avatars5.githubusercontent.com185.199.109.133             avatars4.githubusercontent.com185.199.109.133             avatars3.githubusercontent.com185.199.108.133             avatars2.githubusercontent.com185.199.109.133             avatars1.githubusercontent.com185.199.111.133             avatars0.githubusercontent.com185.199.111.133             avatars.githubusercontent.com52.193.111.178              codeload.github.com52.216.177.203              github-cloud.s3.amazonaws.com52.216.177.203              github-com.s3.amazonaws.com52.217.91.148               github-production-release-asset-2e65be.s3.amazonaws.com52.217.91.148               github-production-user-asset-6210df.s3.amazonaws.com52.217.91.148               github-production-repository-file-5c1aeb.s3.amazonaws.com185.199.109.153             githubstatus.com64.71.144.211               github.community52.237.112.130              github.dev140.82.112.21               collector.github.com13.107.42.16                pipelines.actions.githubusercontent.com185.199.108.133             media.githubusercontent.com185.199.108.133             cloud.githubusercontent.com


    
185.199.108.133             objects.githubusercontent.com# last fetch time: 2022-06-11T23:00:02+08:00# update url: https://hosts.gitcdn.top/hosts.txt# fetch-github-hosts end

需要注意的是,在windows中,大家修改完hosts之后,直接保存不了,保存的时候先另存在桌面,再拖进去覆盖即可!

刷新生效:

Linux: /etc/init.d/network restartWindows: ipconfig /flushdnsMacos: sudo killall -HUP mDNSResponder

试试访问效果

开源仓库:
https://github.com/Licoy/fetch-github-hosts

GitHub镜像站
或者使用Github镜像站,国内可以加速访问GitHub的网站(GitHub加速),使用起来和官网没啥区别,只是域名不同而已。
  • https://hub.おうか.tw
  • https://hub.連接.台灣
  • https://hub.fastgit.xyz
  • https://cdn.githubjs.cf
  • https://gitclone.com
如果这篇文章大家觉得有用,请点个赞!


作者:晓宇
来源:芯片之家

版权归原作者所有,如有侵权,请联系删除。
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/137440