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