Install latest git on CentOS from source code

  1. prepare build tools if tools not ready
    1
    yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker
  2. remove old version git
    1
    yum remove git
  3. download latest version git from https://mirrors.edge.kernel.org/pub/software/scm/git/
    1
    2
    3
    wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz
    tar zxvf git-2.9.5.tar.gz
    cd git-2.9.5
  4. complie and install
    1
    2
    3
    ./configure --prefix=/usr/local/git
    make
    make install
  5. set env path
    1
    2
    echo 'export PATH=$PATH:/usr/local/git/bin' >> /etc/bashrc
    source /etc/bashrc
  6. it’s done, check git version
    1
    git --version

Reference from

  1. https://stackoverflow.com/questions/21820715/how-to-install-latest-version-of-git-on-centos-7-x-6-x
  2. https://www.jianshu.com/p/729f4f313642