V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
just1
V2EX  ›  分享创造

Github 文件加速更新,支持 clone 加速

  •  1
     
  •   just1 · 2020-03-24 13:23:16 +08:00 · 7229 次点击
    这是一个创建于 1465 天前的主题,其中的信息可能已经有所发展或是发生改变。

    gh-proxy

    前情提要

    /t/655015

    现在支持了 clone,并且有两种方式可以选择

    1 clone 走 github.com.cnpmjs.org (302) (默认)

    2 clone 走 cloudflare workers

    简介

    利用 Cloudflare Workers 对 github release 、archive 以及项目文件进行加速,并且支持 clone,部署无需服务器且自带 cdn 。

    演示

    https://gh.api.99988866.xyz/

    使用 直接在 copy 出来的文件 url 或者 https clone 地址前加https://gh.api.99988866.xyz/ 即可 比如

    git clone https://gh.api.99988866.xyz/https://github.com/hunshcn/gh-proxy.git
    

    也可以直接访问,在 input 输入

    更多使用方法可以移步我的博客

    代码

    开源于 Github https://github.com/hunshcn/gh-proxy

    第 1 条附言  ·  2020-04-09 23:19:35 +08:00
    20200409 新增 python 版本,可以部署到自己服务器上了 @stille
    25 条回复    2020-08-04 12:13:39 +08:00
    nl101531
        1
    nl101531  
       2020-03-24 13:49:19 +08:00
    赞一个,这东西有用
    justin2018
        2
    justin2018  
       2020-03-24 13:54:40 +08:00
    刚刚发了一个帖子咨询 如何加速 GitHub 就看到楼主的帖子了 😅 试一试 谢谢楼主分享~
    lework1234
        3
    lework1234  
       2020-03-24 14:44:04 +08:00
    care
        4
    care  
       2020-03-24 19:16:04 +08:00 via iPhone
    像 composer 这种默认要从 github 拉项目依赖的包管理器这种方式可以使用吗?
    just1
        5
    just1  
    OP
       2020-03-24 19:30:05 +08:00 via Android
    @care 不知道他的工作原理,待我尝试一下
    just1
        6
    just1  
    OP
       2020-03-24 20:02:52 +08:00
    @care #4 只需要将 composer.json 里面在 github.com 网址如上使用规则替换就可以,composer 下载 repositories 事实上是 https 协议的 clone
    0lobster0
        7
    0lobster0  
       2020-03-25 07:36:37 +08:00 via Android
    有个问题请教,Cloudflare Workers 部署的网站,如 jsproxy 。不挂代理访问不上啊,请问你这个部署的可以访问,是怎么回事?
    just1
        8
    just1  
    OP
       2020-03-25 09:58:05 +08:00
    @0lobster0 #7 没遇到过这个问题,workers.dev 我也可以直接访问,不然你尝试绑定一下自己的域名?
    0lobster0
        9
    0lobster0  
       2020-03-25 11:08:50 +08:00 via Android
    @just1 #8 是我自己的问题,workers 那块自己取的名子,换了一个就好了,可能之前名字( 996icu )全网封杀吧🤣
    bbbb
        10
    bbbb  
       2020-03-25 20:11:09 +08:00
    太感谢了,在服务器上想操作的的时候真是太方便了。
    hippieZhou
        11
    hippieZhou  
       2020-03-27 10:35:33 +08:00
    支持,昨天 Clone 一个仓库花费了我一天的时间,每次快要完成的时候就 EOF 了
    neighbads
        12
    neighbads  
       2020-03-27 16:52:15 +08:00
    配置自定义域名后是不是有问题。一直 523
    just1
        13
    just1  
    OP
       2020-03-27 17:30:34 +08:00
    @neighbads #12 你指的自定义域名是?正常部署不需要修改代码任何部分
    neighbads
        14
    neighbads  
       2020-03-27 17:49:02 +08:00
    Worker 页面配置了自定义域名,cname 转到 worker 地址 https://gh.api.99988866.xyz
    just1
        15
    just1  
    OP
       2020-03-27 18:16:29 +08:00
    @neighbads #14 自带的 dev 域名应该可以使用吧?
    如果要自定义域名,到域名的 workers 那里添加路由配置 sub.youdomain.com/*到你的 worker,然后还是得为 sub 指定一个 A 记录不然不签发 ssl 证书
    neighbads
        16
    neighbads  
       2020-03-27 18:23:45 +08:00
    @just1 #15 ok 解决了,忘记在后面加 /* 了,感谢
    chich14
        17
    chich14  
       2020-03-28 11:39:32 +08:00
    试用了一下,很方便,赞一个
    INTEL2333
        18
    INTEL2333  
       2020-04-04 15:28:31 +08:00
    不错不错,比 jsproxy 方便
    stille
        19
    stille  
       2020-04-08 23:28:47 +08:00
    这个能部署到 vps 么? 求教程
    avenger
        20
    avenger  
       2020-04-22 20:23:45 +08:00
    感谢楼主,请问支持私有 repo 吗?
    huyinjie
        21
    huyinjie  
       2020-07-09 19:40:31 +08:00
    感谢楼主 请问是否能支持下类似 https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh 的加速,某些云服务连接不上
    lxk11153
        22
    lxk11153  
       2020-08-04 10:37:11 +08:00
    "warning: redirecting to" 是怎么了?
    just1
        23
    just1  
    OP
       2020-08-04 11:05:40 +08:00 via Android
    lxk11153
        24
    lxk11153  
       2020-08-04 11:12:53 +08:00
    @just1 #23 不过现在又快起来了,之前有次几 kb/s
    > git clone --depth 1 'https://gh.api.99988866.xyz/https://github.com/DaHMao/SameCourse.git'
    Cloning into 'SameCourse'...
    warning: redirecting to https://github.com.cnpmjs.org/DaHMao/SameCourse.git/

    > git clone 'https://gh.api.99988866.xyz/https://github.com/DaHMao/SameCourse.git'
    Cloning into 'SameCourse'...
    warning: redirecting to https://github.com.cnpmjs.org/DaHMao/SameCourse.git/
    just1
        25
    just1  
    OP
       2020-08-04 12:13:39 +08:00
    @lxk11153 #24 因为演示站就是重定向到 cnpmjs 的镜像,这个是香港阿里云,国内访问正常会比 cf 快,这个 warning 可以无视,是正确的
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3099 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 14:34 · PVG 22:34 · LAX 07:34 · JFK 10:34
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.