Linux Install Git method

Source: Internet
Author: User

Excerpt from Baidu Experience

To install the GIT client on Linux, the system is centos6.5 64-bit with the following steps.

Tools/Materials
    • Git

    • CentOS6.5

    • V2.3.0.zip

Method/Step
    1. 1

      Use the git--version command to check if it's installed

    2. 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. 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
  1. Update the system first

    Yum-y Update

    After the update is complete, 6.5 becomes 6.7.

  2. Installing a dependent Package

    Yum-y Install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-extutils-makemaker

  3. 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

  4. 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.

  5. 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

  6. 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

  7. Do not want to restart the system, use the source command to take effect immediately

    Source/etc/profile

  8. 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

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.