Excerpt from Baidu Experience
To install the GIT client on Linux, the system is centos6.5 64-bit with the following steps.
Tools/Materials
Method/Step
-
1
Use the git--version command to check if it's installed
-
2
In the CentOS5 version, because there is no git in the Yum source, you need to pre-install a series of dependent packages. There is already a git version in the CentOS6 yum source and can be installed directly using the Yum source.
-
3
Yum-y Install git
However, the GIT version installed in the Yum source is a minimum of 1.7 of the GIT versions required, such as 1.7.1,github. 2. So we generally do not use the above method, but rather download git source code compiled installation.
END
Compiling and installing Git
-
Update the system first
Yum-y Update
After the update is complete, 6.5 becomes 6.7.
-
Installing a dependent Package
Yum-y Install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-extutils-makemaker
-
Download git source and unzip
$ wget Https://github.com/git/git/archive/v2.3.0.zip
$ unzip V2.3.0.zip
$ CD git-2.3.0
-
Compile and install:
Install it under the "/usr/local/git" directory.
Make Prefix=/usr/local/git All
Make Prefix=/usr/local/git Install
Because the server time is not error during compilation, use Ntpdate to automatically correct the system time. Error "Writing Perl.mak for Git make[2]: * * * [Perl.mak] Error 1", please restart Apache services, service httpd restart.
-
After compiling, using Git--version to see the git version is still 1.7.1, because it uses git under "/usr/bin" by default.
You can use the following command to see the path to git:
$ Whereis git
Git:/usr/bin/git/usr/local/git/usr/share/man/man1/git.1.gz
-
We're going to put the compiled git path into the environment variable and let it replace git under "/usr/bin." For this we can modify the "/etc/profile" file (or/ETC/BASHRC file).
Vim/etc/profile
Then, in the last line of the file, add the following, and then save the exit.
Export Path=/usr/local/git/bin: $PATH
-
Do not want to restart the system, use the source command to take effect immediately
Source/etc/profile
-
Then use Git--version again to view the Git version and find out 2.3.0, indicating that the installation was successful.
END
Linux Install Git method