Centos – How to correctly install Git 2.17.1 from source on CentOS 7.4

centosgitsoftware installationsource

I'd like to install latest available git to day (git-2.17.1), on CentOS 7.4, because some applications are complaining for it, and not only.

I'm trying to install git-2.17.1 from source on CentOS 7.4.

These are the approachs I tried:

  • Uninstalled the old git (only) using:

a) rpm -e --nodeps git

  • Downloaded and extracted the file git-2.17.1.zip on /home/myusername/temp/

  • Changed to the extracted file's directory, in this case /home/myusername/temp/git-2.17.1/

  • As a super user, installed all supposedly needed dependencies, using:

a) yum install docbook2X-0.8.8-17.el7.x86_64.rpm (after having downloaded this package)

b) yum install dh-autoreconf curl-devel expat-devel gettext-devel openssl-devel perl-devel zlib-devel asciidoc xmlto gengetopt autoconf libcurl-devel gcc kernel-headers debhelper intltool perl-Git po-debconf

  • Created a symlink as instructed on git-scm web site, using:

a) ln -s /usr/bin/db2x_docbook2texi /usr/bin/docbook2x-texi

  • As a normal user, ran the following:

  • ./configure CFLAGS='-I/usr/local/openssl/include' LDFLAGS='-L/usr/local/openssl/lib' --prefix=/usr/local/git --with-openssl=/usr/local/bin/openssl

  • make all doc info

  • And again, as a super user, ran the following:

  • make install install-doc install-html install-info

The problem arises on last step, outputting the following:

install -m 644 git.info gitman.info /usr/local/git/share/info
if test -r /usr/local/git/share/info/dir; then \
  install-info --info-dir=/usr/local/git/share/info git.info ;\
  install-info --info-dir=/usr/local/git/share/info gitman.info ;\
else \
  echo "No directory found in /usr/local/git/share/info" >&2 ; \
fi
No directory found in /usr/local/git/share/info
mak
e[1]: Leaving directory `/home/myusername/temp/git-2.17.1/Documentation'

I successfully upgraded openssl version to the latest available today (openssl 1.1.0h).

Best Answer

That's not error, you can check it with echo $? after running make install-info. Target install-info in Documentation/Makefile looks like this:

install-info: info
    $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
    $(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
    if test -r $(DESTDIR)$(infodir)/dir; then \
      $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
      $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
    else \
      echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
    fi

Program named install correctly creates info-pages in /usr/local/git/share/info/, you can check it:

$ ls -lh /usr/local/git/share/info/
total 2.3M
-rw-r--r-- 1 root root 218K Jun 13 21:46 git.info
-rw-r--r-- 1 root root 2.1M Jun 13 21:46 gitman.info

The install-info target was introduced in commit 4739809c and says:

If the info target directory does not already contain a "dir" file, no directory entry is created.

A file named dir is a part of GNU texinfo but it's not required.

Also notice that unless you have /usr/local/git/bin/ in your $PATH you cannot start git by simply typing git after installing it the way you did, you have to do this instead:

$ /usr/local/git/bin/git --version
git version 2.17.1
Related Question