Git安装
yum方式在线安装git
[root@VM-4-3-centos usr]
[root@VM-4-3-centos usr]
[root@VM-4-3-centos usr]
git: /usr/bin/git /usr/share/man/man1/git.1.gz
[root@VM-4-3-centos usr]
git version 1.8.3.1
源码方式编译安装git
下载源代码包
github上下载 源码 => v2.38.0 => Source code(tar.gz)
安装编译工具
参考 安装【gcc/ggcc-c++ in CentOS7.x】
编译安装步骤
- 上传到 /usr/local/src 目录下
[root@jenkins02 ~]
总用量 365064
-rw-r--r--. 1 root root 20009 6月 7 18:08 docker_install.sh
-rw-r--r--. 1 root root 10477541 10月 10 14:11 git-2.38.0.tar.gz
- 安装编译服务工具
[root@jenkins02 git-2.38.0]
[root@jenkins02 git-2.38.0]
- 解压到指定目录&编译安装
[root@jenkins02 src]
[root@jenkins02 git-2.38.0]
[root@jenkins02 git-2.38.0]
[root@jenkins02 git-2.38.0]
总用量 0
drwxr-xr-x. 2 root root 154 10月 10 14:29 bin
drwxr-xr-x. 3 root root 22 10月 10 14:29 libexec
drwxr-xr-x. 8 root root 90 10月 10 14:29 share
- 查看编译后版本
[root@jenkins02 git-2.38.0]
git version 2.38.0
- 配置git环境变量
[root@jenkins02 bin]
……
export PATH=$PATH:/usr/local/git-2.38.0/bin
……
[root@jenkins02 bin]
-bash: /usr/bin/git: 没有那个文件或目录
[root@jenkins02 bin]
[root@jenkins02 bin]
git version 2.38.0
[root@jenkins02 bin]
/usr/local/git-2.38.0/bin/git
[root@jenkins02 bin]
git: /usr/local/git-2.38.0/bin/git