构建机部署之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
相关推荐
辉灰笔记12 分钟前
MySQL8 意外关机/误移data目录导致服务启动失败 PID报错/权限报错 修复文档
linux·数据库·mysql·centos
ylscode2 小时前
CVE-2026-31694 漏洞深度分析:Linux 内核 FUSE 组件存在本地提权风险,普通用户可直取 root 权限
linux·运维·服务器
无足鸟ICT3 小时前
【RHCA+】bash命令
linux·开发语言·bash
weixin_307779133 小时前
Linux下Docker Compose里运行的MySQL数据库故障诊断Shell脚本
linux·运维·mysql·docker·自动化
小生不才yz3 小时前
Shell脚本精读 · S14-02 | 脚本模板:从 20 行工具到可维护项目
linux
x-cmd3 小时前
Linus 9 年前说「模糊测试有效」——今天已成 OSS-Fuzz 时代铁律
linux·ai·rust·开源·自动化·agent·安全性测试
Elasticsearch4 小时前
开发者关系新闻通讯 — 2026 年 6 月
elasticsearch
流浪0014 小时前
Git篇(三):吃透远程协作:SSH 密钥、分支、标签全流程实战指南
运维·git·ssh
峥嵘life4 小时前
Repo 常用操作手册
大数据·elasticsearch·搜索引擎
六点_dn5 小时前
Linux学习笔记-chmod命令
linux·笔记·学习