git compile and upgrade installation from source [centos]

Prepare

Download the latest version of the official git repository from github https://github.com/git/git/releases [By the way, worship God, the creator of git is linus Torvalds]

Choose a random rc from the warehouse. There may be problems with the version to be released. We directly download the version number with only numbers.

Download and unzip

#下载
wget https://github.com/git/git/archive/v2.16.2.tar.gz
#解压
tar xzvf v2.16.2.tar.gz
#进入到 git文件夹
cd git-2.16.2/

Install necessary components

yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
yum install  gcc perl-ExtUtils-MakeMaker

Installation steps refer to https://github.com/git/git/blob/master/INSTALL

There is also a tutorial for installing components in the above document. If it is not installed, the following error may occur.

   CC credential-store.o
In file included from credential-store.c:1:0:
cache.h:40:18: fatal error: zlib.h: No such file or directory
 #include <zlib.h>
                  ^
compilation terminated.
make: *** [credential-store.o] Error 1

to install


$ make configure ;# as yourself
$ ./configure --prefix=/usr ;# as yourself
$ make all doc ;# as yourself
# make install install-doc install-html;# as root

an examination

[root@martincentos git-2.16.2]# git --version
git version 2.16.2

But there is still a problem. My git documentation has not been updated.
Just hit man git and you can see the version of the manpage at the bottom.

update git manpage

In fact, when installing git above, it will also prompt that there is a problem with the gitmanpage installation.

We upgrade manpage separately first download the manpage package
from https://mirrors.edge.kernel.org/pub/software/scm/git/

wget https://mirrors.edge.kernel.org/pub/software/scm/git//git-manpages-2.16.2.tar.gz

update manpage

tar xzv -C /usr/local/share/man -f git-manpages-2.16.2.tar.gz 

# 说明一下参数 -C 表示解压到某个目录中
root@martincentos ~]# tar --help | grep -e "-C"
  -C, --directory=DIR        change to directory DIR

-f 表示 tar 文件

Now recheck man git to the bottom

5. git@vger.kernel.org
    mailto:git@vger.kernel.org

Git 2.16.2                        02/15/2018                            GIT(1)
(END) 

Upgrade complete OH YEAH!

Tip: It is best to back up the /usr/local/share/manfolder before operation

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325937102&siteId=291194637