CentOS Install git

Source: Internet
Author: User

Method #1 » Install with Yum source :

[[email protected] ~]# sudo yum install git

To view the version number of the installed git:

[[email protected] ~]# git--versiongit version 1.8.3.1

But the GIT version installed in the Yum source is 1.8.3.1, too old.

Method #2 » Download git source, compile and install :

1. Update the installation Source:

[[email protected] ~]# Yum update

2. Install the GIT dependent packages:

[email protected] ~]# Yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc Perl-extutils-makema Ker

3. Go to the GIT website to see the latest version of 2.8.1:

https://git-scm.com/download/

4. Download the Git source code and unzip it:

[Email protected] ~]# wget https://github.com/git/git/archive/v2.8.1.zip[[email protected] ~]# unzip v2.8.1.zip[[ Email protected] ~]# CD git-2.8.1

5. Compile and install to the "/usr/local/git" directory:

At this point, use Git--version to view the Git version, and still find the 1.8.3.1 Version. This is because it uses git under "/usr/bin" by default.

[[email protected] ~]# git--versiongit version 1.8.3.1

Then look at the path where Git is located:

[Email protected] git-2.8.1]# Whereis gitgit:/usr/bin/git/usr/share/man/man1/git.1.gz

6. Set Environment variables:

Put the compiled and installed git path into the environment variable, and let it replace git under "/usr/bin". To do this we can modify the "/etc/profile" file (or the/ETC/BASHRC file) and add "Export Path=/usr/local/git/bin: $PATH" to the last line of the file (that is, 77 lines).

[Email protected] ~]# Vim/etc/profile

Save changes:

[Email protected] ~]# Source/etc/profile

Look at the version number of git again 2.8.1:

[[email protected] ~]# git--versiongit version 2.8.1

  

 

CentOS Install git

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.