安装 git 时,突然报以下错误;提示
为 repo ‘epel-modular’ 下载元数据失败 错误:为 repo ‘epel-modular’ 下载元数据失败
如图所示 解决方案:
修改镜像源为阿里云镜像源
step 1 vi /etc/yum.repos.d/CentOS-Base.repo
修改为如下内容
[BaseOS]
name=CentOS-$releasever - Base
release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra
baseurl=https://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
step 2 vi /etc/yum.repos.d/CentOS-AppStream.repo
修改为如下内容
[AppStream]
name=CentOS-$releasever - AppStream
release=$releasever&arch=$basearch&repo=AppStream&infra=$infra
baseurl=https://mirrors.aliyun.com/centos/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
step 3 重建缓存
# 清除所有缓存文件
dnf clean all
# 制作元数据缓存
dnf mackecache
经过以上步骤,再次安装 git 执行成功