Rate This Document
Findability
Accuracy
Completeness
Readability

Installing Git

  1. Download the source code of Git v2.21.0.
    1
    wget https://github.com/git/git/archive/v2.21.0.tar.gz
    
  2. Decompress v2.21.0.tar.gz.
    1
    tar -zxvf v2.21.0.tar.gz
    
  3. Go to the Git source code directory.
    1
    cd git-2.21.0/
    
  4. Check whether Git has been installed. If no, skip this step. If yes, uninstall the original Git.
    1
    git
    

  5. Optional: Uninstall the original Git.
    1
    yum remove git
    
  6. Compile Git.
    1
    2
    3
    4
    autoconf
    ./configure --prefix=/usr/local/git
    make
    make install
    
  7. Configure Git environment variables.
    1
    echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/profile
    
  8. Make the environment variables take effect.
    1
    source /etc/profile
    
  9. Query the Git version.
    1
    git --version
    

    If the following information is displayed, Git has been installed: