构建机部署之git安装(Linux)

这里是通过源码编译的方式安装,如果对版本没有要求,可以通过yum命令直接安装。

  1. 如果已有安装的git,需要卸载掉
    yum remove git
  2. 到github自行选择版本下载:github git
  3. 将安装包上传到服务器并解压
    tar -zxvf git-版本号.tar.gz
  4. 安装git前安装可能需要的依赖
bash 复制代码
yum install curl-devel expat-devel openssl-devel zlib-devel gcc-c++ 
yum install perl-ExtUtils-MakeMaker automake autoconf libtool make
  1. 编译安装git
bash 复制代码
cd git解压目录
make configure
./configure --prefix=/usr/local/git
make profix=/usr/local/git
make install
  1. 将git加入环境变量
    编辑配置文件
    vim /etc/profile
    末尾增加
bash 复制代码
export GIT_HOME=/usr/local/git
export PATH=$PATH:$GIT_HOME/bin

刷新profile配置文件

source /etc/profile

  1. 查看git版本
    git --version
相关推荐
深海鱼在掘金9 小时前
Git 完全指南 —— 第3章:理解工作区、暂存区、版本库三个核心
git
Web3探索者10 小时前
可视化服务器管理和传统命令行区别是什么?新手教程:Linux 运维到底该用图形界面还是 SSH 命令行?
linux·ssh
江华森10 小时前
Git 基础筑基:从原理到团队协作的全栈实战
git
zylyehuo12 小时前
Linux系统中网线与USB网络共享冲突
linux
JakeJiang14 小时前
Git 必备命令指南:从日常高频到项目开发实战
git
Elasticsearch1 天前
Kibana 中的 SNMP 拓扑数据:从采集到 Canvas
elasticsearch
叫我少年1 天前
Windows 中安装 git
git
Sokach10152 天前
Linux Shell 脚本从零到能用:一个新手的一天学习总结
linux
AlfredZhao2 天前
Docker 容器时区不对,`timedatectl` 不存在怎么办?
linux·timezone