# git-dist **Repository Path**: oscstudio/git-dist ## Basic Information - **Project Name**: git-dist - **Description**: git auto build script - **Primary Language**: Shell - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 7 - **Forks**: 5 - **Created**: 2017-07-11 - **Last Updated**: 2025-04-02 ## Categories & Tags **Categories**: ci **Tags**: None ## README # Git 快速构建脚本 这个项目是 Gitee 的 Git 构建脚本集合。 ## 常规操作 编译安装 Git,源代码来自 `mirrors.edge.kernel.org`: ```shell bash <(curl -fsSL https://gitee.com/oscstudio/git-dist/raw/master/git-dist-kernel.sh) ``` 编译安装 Git,源代码来自:Github ```shell bash <(curl -fsSL https://gitee.com/oscstudio/git-dist/raw/master/git-dist.sh) ``` 安装 CMake 二进制来自于:CMake ```shell bash <(curl -fsSL https://gitee.com/oscstudio/git-dist/raw/master/cmake.sh) ``` 安装 CMake 二进制来自于:Github ```shell bash <(curl -fsSL https://gitee.com/oscstudio/git-dist/raw/master/cmake-github.sh) ``` ## 创建符号链接 ```shell sudo ln -sf /usr/local/bin/git* /usr/bin/ ``` ## 构建 git 的 STGZ 安装包: 本节的编译需要安装 PowerShell Core。 ```shell git clone https://gitee.com/oscstudio/git-dist.git cd git-dist/ps ./build.ps1 -prefix /usr/local -pack /tmp/workroot/git-linux-amd64-${GIT_VERSION}.sh --pefix=/usr/local ``` 构建 STGZ 安装包的脚本通常运行较慢,因其需要下载 OpenSSL,CURL,NGHTTP2 等依赖并编译。另外,构建过程中设置的 `-prefix` 应当与 安装的 `--prefix` 一致,只要是操作系统发行版向下兼容的,基本上可以直接分发 `git-linux-amd64-${GIT_VERSION}.sh` 到特定机器上进行安装,从而省去了编译的过程,实际上为了避免卸载麻烦,可以统一 `prefix` 为 `/home/git/tools` 然后将 `/home/git/tools/bin/git*` 软链到 `/usr/local/bin`。`prefix` 需要一致说明 git 的相关代码与预期不一致。 注意:**PowerShell 的参数风格与 GNU 的不一致,这里 `-prefix` 与 `--prefix` 的差异需要注意**。