sudo yum install -y epel-release
sudo yum install -y https://repo.ius.io/ius-release-el7.rpm

如果有错误提示

警告:/var/cache/yum/x86_64/7/epel/packages/epel-release-7-14.noarch.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 352c64e5: NOKEY                      ]  0.0 B/s |    0 B  --:--:-- ETA
epel-release-7-14.noarch.rpm 的公钥尚未安装
epel-release-7-14.noarch.rpm                                                                                                                                 |  15 kB  00:00:00
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 检索密钥

获取 GPG 密钥失败:[Errno 14] curl#37 - "Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7"

执行下面的再继续执行

sudo rpm --import https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7
yum install -y  https://repo.ius.io/ius-release-el7.rpm
yum install -y git236

找不到git236的话用下面命令,安装对应的

yum list git2*
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
可安装的软件包
git236.x86_64                                                                                 2.36.6-1.el7.ius                                                                  ius

可以看到有对应的最新版本