LOGO OA教程 ERP教程 模切知识交流 PMS教程 CRM教程 开发文档 其他文档  
 
网站管理员

GitHub国内无法访问问题的解决方法

admin
2026年1月8日 10:43 本文热度 436

 

1.使用Gitlab的next-hosts

复制下面的脚本并用Bash运行即可。

#!/bin/bash


# 定义 hosts 文件路径

HOSTS_FILE="/etc/hosts"


# GitHub 相关映射的开始和结束标记

START_MARK="# GitHub Host Start"

END_MARK="# GitHub Host End"


# 删除 hosts 文件中的 GitHub 相关映射

echo"删除 hosts 文件中 GitHub 相关的映射..."

sed -i "/$START_MARK/,/$END_MARK/d""$HOSTS_FILE"


# 获取新的 GitHub 映射内容

echo"从 https://gitlab.com/ineo6/hosts/raw/master/next-hosts 获取新的映射..."

curl -s https://gitlab.com/ineo6/hosts/raw/master/next-hosts -o /tmp/new_hosts


# 将新的映射内容添加到 hosts 文件中

echo"将新的映射内容插入到 hosts 文件中..."

{

echo"$START_MARK"

cat /tmp/new_hosts

echo"$END_MARK"

}>>"$HOSTS_FILE"


# 清理临时文件

rm /tmp/new_hosts


echo"操作完成,GitHub 相关映射已更新。"

2.使用类Steam++的加速器进入

以下列出所有支持加速Github的加速器

https://steampp.net/
https://www.ourplay.net/
https://github.com/skydevil88/XboxDownload

waitting update...

3.Github520项目

https://github.com/521xueweihan/GitHub520
该项目通过每日使用脚本来测出Github最新可用IP并更新到项目的Hosts中

# GitHub520 Host Start

140.82.114.25 alive.github.com

140.82.114.5 api.github.com

140.82.112.21 api.individual.githubcopilot.com

185.199.109.133 avatars.githubusercontent.com

185.199.109.133 avatars0.githubusercontent.com

185.199.109.133 avatars1.githubusercontent.com

185.199.109.133 avatars2.githubusercontent.com

185.199.109.133 avatars3.githubusercontent.com

185.199.109.133 avatars4.githubusercontent.com

185.199.109.133 avatars5.githubusercontent.com

185.199.109.133 camo.githubusercontent.com

140.82.114.21 central.github.com

185.199.109.133 cloud.githubusercontent.com

20.205.243.165 codeload.github.com

140.82.113.22 collector.github.com

185.199.109.133 desktop.githubusercontent.com

185.199.109.133 favicons.githubusercontent.com

20.205.243.166 gist.github.com

16.15.223.226 github-cloud.s3.amazonaws.com

16.15.187.203 github-com.s3.amazonaws.com

16.15.194.255 github-production-release-asset-2e65be.s3.amazonaws.com

3.5.11.213 github-production-repository-file-5c1aeb.s3.amazonaws.com

3.5.3.214 github-production-user-asset-6210df.s3.amazonaws.com

192.0.66.2 github.blog 20.205.243.166 github.com

140.82.113.18 github.community

185.199.111.154 github.githubassets.com

151.101.193.194 github.global.ssl.fastly.net

185.199.110.153 github.io

185.199.109.133 github.map.fastly.net

185.199.110.153 githubstatus.com

140.82.112.26 live.github.com

185.199.109.133 media.githubusercontent.com

185.199.109.133 objects.githubusercontent.com

13.107.42.16 pipelines.actions.githubusercontent.com

185.199.109.133 raw.githubusercontent.com

185.199.109.133 user-images.githubusercontent.com

13.107.213.73 vscode.dev

140.82.112.22 education.github.com

185.199.109.133 private-user-images.githubusercontent.com

# Update time: 2026-01-08T00:09:42+08:00

# Update url: https://raw.hellogithub.com/hosts

# Star me: https://github.com/521xueweihan/GitHub520

# GitHub520 Host End

将该Hosts复制到机器的Hosts文件内应当可以解决问题。

4.github-hosts项目

Github地址:https://github.com/feng2208/github-hosts
国内镜像:https://feng2208.pages.dev/github-hosts
从命令提示符启动,在执行命令前先关闭浏览器。

4.1.Google Chrome

4.1.1.Windows

​"C:\Program Files\Google\Chrome\Application\chrome.exe" --host-rules="MAP github.com octocaptcha.com, MAP github.githubassets.com yelp.com, MAP *.githubusercontent.com yelp.com" --host-resolver-rules="MAP octocaptcha.com 140.82.113.4, MAP yelp.com 199.232.240.116"

4.1.2.MacOS

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --host-rules="MAP github.com octocaptcha.com, MAP github.githubassets.com yelp.com, MAP *.githubusercontent.com yelp.com" --host-resolver-rules="MAP octocaptcha.com 140.82.113.4, MAP yelp.com 199.232.240.116"

4.2.Microsoft Edge

首先在浏览器设置-系统和性能将启动增强关闭。

"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --host-rules="MAP github.com octocaptcha.com, MAP github.githubassets.com yelp.com, MAP *.githubusercontent.com yelp.com" --host-resolver-rules="MAP octocaptcha.com 140.82.113.4, MAP yelp.com 199.232.240.116"

tips:
输入指令之前请检查路径是否正确
github-hosts还有更多其他的用处,请自行探索


该文章在 2026/1/8 10:43:15 编辑过
关键字查询
相关文章
正在查询...
点晴ERP是一款针对中小制造业的专业生产管理软件系统,系统成熟度和易用性得到了国内大量中小企业的青睐。
点晴PMS码头管理系统主要针对港口码头集装箱与散货日常运作、调度、堆场、车队、财务费用、相关报表等业务管理,结合码头的业务特点,围绕调度、堆场作业而开发的。集技术的先进性、管理的有效性于一体,是物流码头及其他港口类企业的高效ERP管理信息系统。
点晴WMS仓储管理系统提供了货物产品管理,销售管理,采购管理,仓储管理,仓库管理,保质期管理,货位管理,库位管理,生产管理,WMS管理系统,标签打印,条形码,二维码管理,批号管理软件。
点晴免费OA是一款软件和通用服务都免费,不限功能、不限时间、不限用户的免费OA协同办公管理系统。
Copyright 2010-2026 ClickSun All Rights Reserved