linux下github全局加速——fastgithub

2024-12-15 17:29:37 0点赞 1收藏 0评论

安装 fastgithub

国内大部分服务器无法访问github,或者即时能访问也是速度慢,时灵时不灵的。需要给github加速一下。
一般有四种方法:

  1. 修改 /etc/hosts 文件,需要实时更新

  2. 本地下载文件之后再上传到服务器。需要二道程序

  3. 通过镜像来加速。
    3.1 通过gitee加速,通过修改github地址来将相应的文件改到gitee下载,适用于单文件并且在gitee有镜像仓库,不适应于脚本安装,修改了量太大。
    3.2 通过在github网址前加入https://mirror.ghproxy.com/https://gitclone.com/;等前缀来加速,需要配置git的config文件(见下面),对于 curl 和 wget命令无效。

    #https://gitclone.com/ 可修改为其他镜像前缀 #当前用户替换 git config --global url."https://gitclone.com/".insteadOf https:// git clone https://github.com/espnet/espnet.git # 全用户替换 git config --system url."https://gitclone.com/".insteadOf https:// git clone https://github.com/espnet/espnet.git

4.用fastgithub做全局代理,这里主讲fastgithub。

# 合并为一行命令 wget -c -O /opt/fastgithub_linux-x64.zip https://gitee.com/chcrazy/FastGithub/releases/download/2.1.4/fastgithub_linux-x64.zip && unzip -d /opt /opt/fastgithub_linux-x64.zip && rm /opt/fastgithub_linux-x64.zip && /opt/fastgithub_linux-x64/fastgithub start

1. //下载FastGithub Linux版安装包到opt目录 # arm版本需要下载 fastgithub_linux-arm64.zip 2. wget -c -O /opt/fastgithub_linux-x64.zip https://gitee.com/chcrazy/FastGithub/releases/download/2.1.4/fastgithub_linux-x64.zip 4. //解压 5. unzip -d /opt /opt/fastgithub_linux-x64.zip 10. //删除FastGithub Linux版安装包 11. rm /opt/fastgithub_linux-x64.zip 13. //切换目录 14. cd /opt/fastgithub_linux-x64 16. //以systemd服务安装并启动,即开机自启动 18. sudo /opt/fastgithub_linux-x64/fastgithub start 19. //卸载服务 20. sudo /opt/fastgithub_linux-x64/fastgithub stop 22. //手动启动 23. sudo /opt/fastgithub_linux-x64/fastgithub

 

sudo ./fastgithub start

以systemd服务安装并启动,即开机自启动

这样就算成功了:

linux下github全局加速——fastgithub

设置代理

2 手动修改 /etc/profile文件

手动修改代理,在/etc/profile 添加

vim /etc/profile

添加下面代码

export http_proxy=http://127.0.0.1:38457 export https_proxy=http://127.0.0.1:38457`

:wq 保存

source /etc/profile #更新shell

/etc/profile 开机重新会自动加载


作者声明本文无利益相关,欢迎值友理性交流,和谐讨论~

展开 收起
0评论

当前文章无评论,是时候发表评论了
提示信息

取消
确认
评论举报

相关文章推荐

更多精彩文章
更多精彩文章
最新文章 热门文章
1
扫一下,分享更方便,购买更轻松