CentOS7 install Git

A, can be installed with yum

1, install git: yum install git 

2, see the yum repository Git source information: yum info git

3, dependent libraries: yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel

                           yum install gcc-c++ perl-ExtUtils-MakeMaker

4, see the git version, if the default installed version is too low, remove the default installation of git

      4.1 Version information: git --version

      4.2, remove the default git installed: yum remove git

Second, download and install their own Git

       Download the latest git source code:

       https://github.com/git/git/releases

       https://www.kernel.org/pub/software/scm/git/

1. Download

      1.1, enter the directory you want to download: cd soft

      1.2, download a wegt command: wget https://www.kernel.org/pub/software/scm/git/git-2.19.2.tar.gz

2, extract: Extract to here under / usr / local directory

     tar -xzvf soft git-2.19.2.tar.gz -C / usr / local

3, installation

     3.1, after the files are decompressed git directory: cd /usr/local/git-2.19.2

     3.2, perform make configure

              Note: Execute this command, start to go wrong with the following error:

              configure: Setting lib to 'lib' (the default)

              configure: Will try -pthread then -lpthread to enable POSIX Threads.

              configure: CHECKS for site configuration

              checking for gcc... no

              checking for cc... no

              checking for cl.exe... no

              configure: error: in `/opt/git-2.19.0':

              configure: error: no acceptable C compiler found in $PATH

              See `config.log' for more details  

              Solution : Query by yum providers gcc c and yum providers cc to compiler is not installed, the installation can -y install gcc gcc package and a corresponding dependence by performing yum.

              Configuer perform again the make , the error appears again with the following error:

              GIT_VERSION = 2.19.2

              GEN configure

              bin / sh: autoconf: command not found

              make: *** [configure] Error 127

              Solution : Query by yum providers autoconf not installed to autoconf, can -y install autoconf installation package and the corresponding dependency by performing yum. 

     3.3, configuration directory: ./ configure --prefix = / usr / local / git

     3.4、执行 make profix=/usr/local/git

     3.5, perform the installation make insrtall

4. Add the environment variable: echo "export PATH = $ PATH: / usr / git / bin" >> / etc / profile

                               source / etc / profile // entry into force of the modified files

 

5, check the version: git --version

      If the display: git version 2.19.2 is proved successful installation!


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


 

 

 


 

 

 

 

Guess you like

Origin blog.csdn.net/hdn_kb/article/details/90696500