--- title: git安装 date: 2021-11-21 updated: 2021-11-21 tags: - git - linux categories: - linux - git keywords: - git - linux description: git安装 top_img: https://i.loli.net/2021/11/21/kVIqrRQlpSD2avc.jpg comments: true cover: https://i.loli.net/2021/11/21/kVIqrRQlpSD2avc.jpg copyright: true copyright_author: xzh copyright_author_href: http://xxzhx.cn copyright_url: http://xxzhx.cn copyright_info: 著作权归作者所有。商业转载请联络作者获得授权,非商业转载请注明出处。 --- # git安装 ## 下载git包 [下载地址](https://mirrors.edge.kernel.org/pub/software/scm/git/) ![下载git包](https://i.loli.net/2021/11/21/r1sYpudjDFZbJQq.png) ## 上传服务器并解压安装 ### 解压 ```shell tar -zxvf git-2.34.0.tar.gz ``` ### 安装依赖 ```shell yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker ``` ### 检验配置并设置安装路径 ```shell ./configure --prefix=/usr/local/git ``` ### 编译&安装 ```shell make && make install ``` ## 配置环境变量 ```shell vim /etc/profile ``` ### 环境变量 ```js # git环境变量 export GIT_HOME=/usr/local/git export PATH=$PATH:$GIT_HOME/bin ``` ### 刷新配置 ```shell source /etc/profile ``` ## 安装完成 ![查看版本](https://i.loli.net/2021/11/21/2WlMOzNVUGpaK6T.png)