# pgit
pgit 是 Proxy Git 的缩写,使用镜像加速 github 下载,支持 repo,release
# 仓库
# 安装
从github下载
curl -o pgit https://raw.githubusercontent.com/gcslaoli/pgit/main/shell/pgit && chmod +x pgit && sudo mv pgit /usr/local/bin
从gitee下载
curl -o pgit https://gitee.com/gcslaoli/pgit/raw/main/shell/pgit && chmod +x pgit && sudo mv pgit /usr/local/bin
# 使用
对于git clone加速,使用pgit替代git.
pgit会自动判断是否需要加速,如果需要加速,则会自动使用镜像地址.传入的参数与git完全一致,事实上内部使用的也是git.
pgit clone https://github.com/cool-team-official/cool-admin-vue.git
当需要通过wget或者curl下载 relase branch raw 等资源时,可以使用pgit加速.在原wget或者curl命令前加上pgit即可.
例如cool-tools的 wget 安装脚本为:
wget -O cool-tools https://github.com/cool-team-official/cool-admin-go/releases/latest/download/cool-tools_$(go env GOOS)_$(go env GOARCH) && chmod +x cool-tools && ./cool-tools install && rm ./cool-tools
可以使用pgit加速:
pgit wget -O cool-tools https://github.com/cool-team-official/cool-admin-go/releases/latest/download/cool-tools_$(go env GOOS)_$(go env GOARCH) && chmod +x cool-tools && ./cool-tools install && rm ./cool-tools
# 配置
pgit默认使用的镜像地址为https://ghproxy.com/,如果需要使用其他镜像地址,可以设置环境变量PGIT_PREFIX来指定.
例如使用https://gh.hjmcloud.cn/:
export PGIT_PREFIX=https://gh.hjmcloud.cn/
# 自建镜像
如果需要自建镜像,可以使用开源项目gh-proxy (opens new window)来搭建.
← go-oss