zl程序教程

您现在的位置是:首页 >  系统

当前栏目

笔记:使用源代码在 Centos 7 安装 Git 2

centos安装笔记Git 源代码 使用
2023-09-14 09:10:28 时间

笔记:使用源代码在 Centos 7 安装 Git 2

起因

因为需要测试 FastAdmin,搭建了一个 Centos 7 服务器。
但是因为 Centos 7 默认自带的 Git 版本太低,在使用 VSCODE 连接服务器时提示 git 版本太低,需要安装 git 2。

卸载旧版本

执行卸载

sudo yum remove git*

下载git 2

找到最新的 git 2

https://mirrors.edge.kernel.org/pub/software/scm/git/

下载 git 压缩包

目前最新的(2020-09-10)2.9.5

wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.5.tar.xz

解压到当前目录

tar xf git-xxxx.tar.gz

配置编译安装

进入 git 源码目录

配置

marke configure

配置目录

./configure --prefix=/usr/git
make profix=/usr/git

安装

make install

创建 git 软链接

为了方便其他用户也可以使用 git 命令,可以将 git 命令做个软链接到 /usr/bin/ 目录。

可使用以下命令

ln -s /usr/git/bin/git /usr/bin/git

文档

附录

git 源码目录 https://mirrors.edge.kernel.org/pub/software/scm/git/

参考
https://developer.aliyun.com/article/708611

第三方仓库
https://repo.ius.io/

版本

  • v0.5.1
  • 2020-10-08
  • 建伟 F4NNIU