How to compile and install git in the Linux (centos) environment

Source: Internet
Author: User
Tags centos install perl

Recently, git has been used for code release and version management online, but it has never been recorded before. This is recorded from today.

On linux (the current article uses centos, ubuntu uses apt-get, which is not described here) there are two methods to install git: yum installation and source compilation. We do not recommend yum. Yum is an old version. We recommend that you download the source code on github for compilation and installation. Record the following steps here:

1. Install the dependency package.

Install some dependencies before compiling the source code:

Yum install perl cpio curl-devel zlib-devel openssl-develexpat-devel gettex-devel-y

2. Download and compile and install the SDK.

Source code download address: https://github.com/git/git/releases
Here we take the latest version of https://github.com/git/git/archive/v2.11.0-rc1.tar.gz as an example.

Wget https://github.com/git/git/archive/v2.11.0-rc1.tar.gz
Tar zxvf v2.11.0-rc1.tar.gz
Cd git-2.11.0-rc1/
Make configure # note that this step cannot be performed directly by default./configure. If The configure file does not exist, perform this step.
./Configure -- prefix =/usr/local/git
Make
Make install

Installation is complete.

3. Set environment variables.

After compilation and installation, the git command cannot be used directly. You need to set the environment variable. Perform the following operations:

Echo "export PATH =/usr/local/git/bin: $ PATH">/etc/profile
Source/etc/profile

Now you can use it directly. View results:

[Root @ 21 yunwei git-2.11.0-rc1] # git -- version
Git version 2.11.0-rc0

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.