Install git in Linux and gitLinux
Reference: https://git-scm.com/book/zh/v1/%E8%B5%B7%E6%AD%A5-%E5% AE %89%E8%A3%85-Git
Git needs to call the code of libraries such as curl, zlib, openssl, expat, and libiconv. Therefore, install these dependency tools first.
$ yum install curl-devel expat-devel gettext-devel \openssl-devel zlib-devel$ apt-get install libcurl4-gnutls-dev libexpat1-dev gettext \libz-dev libssl-dev
Then, download the latest source code from the following Git official site:
Http://git-scm.com/download
Then compile and install:
$ tar -zxf git-1.7.2.2.tar.gz$ cd git-1.7.2.2$ make prefix=/usr/local all$ sudo make prefix=/usr/local install
If an error occurs during compilation:
usr/bin/perl Makefile.PL PREFIX='/usr/local/git' INSTALL_BASE='' --localedir='/usr/local/git/share/locale'Can't locate ExtUtils/MakeMaker.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at Makefile.PL line 3.BEGIN failed--compilation aborted at Makefile.PL line 3.make[1]: *** [perl.mak] Error 2make: *** [perl/perl.mak] Error 2
Run the following command:
yum install perl-ExtUtils-MakeMaker
After the installation is complete, the git command is located under/usr/local/bin. If you enter the git -- version command, the bash:/usr/bin/git: No such file or directory error occurs, add the bin directory to the path environment variable in/etc/profile.