centos7升级git

关键字:centos7升级git update git version in centos7

way 1

yum install expat-devel libcurl-devel perl-ExtUtils-MakeMaker package zlib zlib-devel -y
yum remove git -y
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.21.3.tar.xz
tar -xvf git-2.21.3.tar.xz
cd git-2.21.3/
./configure && make && make install
ln ./git /usr/bin/git
git --version
# refer: <https://blog.csdn.net/qq_24027457/article/details/80929667>

way 2 (recommand)

git --version # 查看版本
sudo yum remove -y git* # 删除所有git相关
sudo yum remove -y git # 只删除Git

# 在 CentOS 7 上安装新版本 Git 最快的方法是通过 End Point 库。
sudo yum install -y https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm
sudo yum install -y git
git --version # 查看版本

问题 ssh: connect to host github.com port 22

ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

解决步骤:尝试ssh -T git@github.com,此时应该会超时,再尝试ssh -T git@ssh.github.com,此时应该会成功,再ping ssh.github.com,得到ip地址,再将ip地址和github.com的对应保存到hosts文件中,示例

20.205.243.160 github.com

参考:GitHub 远程仓库端口从 22 改为 443,ssh connect to host github.com port 22 Connection timed outfatal Could not read from remote repository.Please make sure you have the correct access rights and the repository exists

作者:admin  创建时间:2024-09-26 11:25
最后编辑:admin  更新时间:2025-09-19 10:08