Redhat升级Git

在项目中,由于Redhat默认Git版本过低(1.7.1),导致jenkins从github拉取packages失败。通过卸载旧版Git,下载最新源码,按照INSTALL文档进行安装。在过程中遇到curl和libcurl版本问题,以及expat-devel依赖问题。通过更新libcurl,安装libcurl-devel和expat-devel包,成功解决Git升级问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

        最近项目中用到jenkins去部署web项目,jenkins配置了shell脚本之后会从github上拉一些packages,但是发现拉不下来,问题我也忘记记录了(哎,搞定之后才想起来去记录一些东西,发现没截图存一下过程)。

查了一下原因是说redhat默认的git 版本是1.7.1的所以建议升级,查了一下服务器上装了yum,所以就先卸载了默认版本的git

yum remove git

下载最新的git源码

wget https://github.com/git/git/tar.gz/v2.16.1

然后解压缩并进入目录。一般我们安装都先去看一下INSTALL文

                     Git installation

Normally you can just do "make" followed by "make install", and that
will install the git programs in your own ~/bin/ directory.  If you want
to do a global install, you can do

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

(or prefix=/usr/local, of course).  Just like any program suite
that uses $prefix, the built results have some paths encoded,
which are derived from $prefix, so "make all; make prefix=/usr
install" would not work.
...
 - Git is reasonably self-sufficient, but does depend on a few external
   programs and libraries.  Git can be used without most of them by adding
   the approriate "NO_<LIBRARY>=YesPlease" to the make command line or
   config.mak file.

        - "zlib", the compression library. Git won't build without it.

        - "ssh" is used to push and pull over the net.

        - A POSIX-compliant shell is required to run many scripts needed
          for everyday use (e.g. "bisect", "pull").

        - "Perl" version 5.8 or later is needed to use some of the
          features (e.g. preparing a partial commit using "git add -i/-p",
          interacting with svn repositories with "git svn").  If you can
          live without these, use NO_PERL.  Note that recent releases of
          Redhat/Fedora are reported to ship Perl binary package with some
          core modules stripped away (see http://lwn.net/Articles/477234/),
          so you might need to install additional packages other than Perl
          itself, e.g. Time::HiRes.

        - "openssl" library is used by git-imap-send to use IMAP over SSL.
          If you don't need it, use NO_OPENSSL.

          By default, git uses OpenSSL for SHA1 but it will use its own
          library (inspired by Mozilla's) with either NO_OPENSSL or
          BLK_SHA1.  Also included is a version optimized for PowerPC
          (PPC_SHA1).

        - "libcurl" library is used by git-http-fetch and git-fetch.  You
          might also want the "curl" executable for debugging purposes.
          If you do not use http:// or https:// repositories, you do not
          have to have them (use NO_CURL).

        - "expat" library; git-http-push uses it for remote lock
          management over DAV.  Similar to "curl" above, this is optional
          (with NO_EXPAT).

        - "wish", the Tcl/Tk windowing shell is used in gitk to show the
          history graphically, and in git-gui.  If you don't want gitk or
          git-gui, you can use NO_TCLTK.

        - A gettext library is used by default for localizing Git. The
          primary target is GNU libintl, but the Solaris gettext
          implementation also works.

          We need a gettext.h on the system for C code, gettext.sh (or
          Solaris gettext(1)) for shell scripts, and libintl-perl for Perl
          programs.

          Set NO_GETTEXT to disable localization support and make Git only
          use English. Under autoconf the configure script will do this
          automatically if it can't find libintl on the system.

        - Python version 2.4 or later (but not 3.x, which is not
          supported by Perforce) is needed to use the git-p4 interface
          to Perforce.

安装文档说的去执行

make prefix=/usr install

发现如下错误截图


是curl的问题,那我们更新 libcurl 版本,并安装相应的 libcurl-devel 开发包。 

yum update curl libcurl 
yum -y install libcurl-devel.x86_64

再次执行安装,发现还有依赖没有装


安装expat-devel包

yum -y install expat-devel.x86_64

再次执行发现ok~



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值