Contents
  1. 1. CentOS6.5升级Git[编译方式]
    1. 1.1. 卸载旧版git
    2. 1.2. 下载/解压源码
    3. 1.3. 编译、安装
    4. 1.4. 环境变量配置

CentOS6.5升级Git[编译方式]

卸载旧版git

1
2
3
4
5
git --version
# 1.7.X

#卸载
yum remove git

下载/解压源码

1
2
3
4
5
wget https://github.com/git/git/archive/v2.9.2.tar.gz

#解压
tar zxvf v2.9.2.tar.gz
cd git-2.9.2

编译、安装

1
2
3
4
make configure
./configure --prefix=/usr/local/git --with-iconv=/usr/local/libiconv
make all doc
sudo make install install-doc install-html

make configure产生Makefile文件并进行编译

./configure --prefix=/usr/local/git 通过configure命令对安装进行控制,将git安装到/usr/local/git目录下。

make all doc 编译生成doc文件

sudo make install install-doc install-html 安装程序文件

环境变量配置

1
2
3
4
5
sudo vim /etc/profile

export PATH=/usr/local/git/bin:$PATH

source /etc/profile # 生效修改
1
2
git --version
#git version 2.9.2

如果机器部署了其它需要依赖Git的服务(比如:GitLab、git、gogs等),升级后,需要重启下服务。本机安装的gogs在升级git后未重启服务进入项目就会提示An error has occurred : exec: "git": executable file not found in $PATH 错误信息.


    
        
        版权声明:
        本文由Lomo创作和发表,采用署名(BY)-非商业性使用(NC)-相同方式共享(SA)国际许可协议进行许可,
        转载请注明作者及出处,本文作者为Lomo,本文标题为CentOS upgrade Git.
    
    


 Leave a message ^_^:

Contents
  1. 1. CentOS6.5升级Git[编译方式]
    1. 1.1. 卸载旧版git
    2. 1.2. 下载/解压源码
    3. 1.3. 编译、安装
    4. 1.4. 环境变量配置