linux安装git

发布于:2025-05-20 ⋅ 阅读:(13) ⋅ 点赞:(0)
[root@MiWiFi-RC06-srv rpm-gpg]# yum install git
已加载插件:fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: d2lzkl7pfhq30w.cloudfront.net
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 git.x86_64.0.2.43.0-1.ep7 将被 安装
--> 正在处理依赖关系 git-core = 2.43.0-1.ep7,它被软件包 git-2.43.0-1.ep7.x86_64 需要
--> 正在处理依赖关系 git-core-doc = 2.43.0-1.ep7,它被软件包 git-2.43.0-1.ep7.x86_64 需要
--> 正在处理依赖关系 perl-Git = 2.43.0-1.ep7,它被软件包 git-2.43.0-1.ep7.x86_64 需要
--> 正在处理依赖关系 perl(Term::ReadKey),它被软件包 git-2.43.0-1.ep7.x86_64 需要
--> 正在处理依赖关系 perl(Git),它被软件包 git-2.43.0-1.ep7.x86_64 需要
--> 正在检查事务
---> 软件包 git-core.x86_64.0.2.43.0-1.ep7 将被 安装
--> 正在处理依赖关系 libpcre2-8.so.0()(64bit),它被软件包 git-core-2.43.0-1.ep7.x86_64 需要
---> 软件包 git-core-doc.noarch.0.2.43.0-1.ep7 将被 安装
---> 软件包 perl-Git.noarch.0.2.43.0-1.ep7 将被 安装
--> 正在处理依赖关系 perl(Error),它被软件包 perl-Git-2.43.0-1.ep7.noarch 需要
---> 软件包 perl-TermReadKey.x86_64.0.2.30-20.el7 将被 安装
--> 正在检查事务
---> 软件包 pcre2.x86_64.0.10.23-2.el7 将被 安装
---> 软件包 perl-Error.noarch.1.0.17020-2.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

===================================================================================================================================================================================
 Package                                        架构                                 版本                                             源                                      大小
===================================================================================================================================================================================
正在安装:
 git                                            x86_64                               2.43.0-1.ep7                                     endpoint                                54 k
为依赖而安装:
 git-core                                       x86_64                               2.43.0-1.ep7                                     endpoint                                11 M
 git-core-doc                                   noarch                               2.43.0-1.ep7                                     endpoint                               3.0 M
 pcre2                                          x86_64                               10.23-2.el7                                      base                                   201 k
 perl-Error                                     noarch                               1:0.17020-2.el7                                  base                                    32 k
 perl-Git                                       noarch                               2.43.0-1.ep7                                     endpoint                                41 k
 perl-TermReadKey                               x86_64                               2.30-20.el7                                      base                                    31 k

事务概要
===================================================================================================================================================================================
安装  1 软件包 (+6 依赖软件包)

总计:14 M
安装大小:46 M
Is this ok [y/d/N]: y
Downloading packages:
警告:/var/cache/yum/x86_64/7/endpoint/packages/perl-Git-2.43.0-1.ep7.noarch.rpm: 头V4 RSA/SHA1 Signature, 密钥 ID 703df089: NOKEY
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-endpoint-7 检索密钥


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

报错

Downloading packages:
警告:/var/cache/yum/x86_64/7/endpoint/packages/perl-Git-2.43.0-1.ep7.noarch.rpm: 头V4 RSA/SHA1 Signature, 密钥 ID 703df089: NOKEY
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-endpoint-7 检索密钥


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

解决方法:

方法一:关闭 GPG 校验(不推荐,仅用于测试或临时解决)

sudo yum install perl-Git --nogpgcheck

不推荐用于生产环境,因为关闭 GPG 校验会有安全风险。


方法二:手动导入 GPG 公钥(推荐)
  1. 获取对应的 GPG 公钥

    如果你使用的是某个特定的 CentOS/RHEL/Endpoint 镜像或私有源,请向维护者或官网查找 RPM-GPG-KEY-endpoint-7

  2. 下载并导入密钥

    假设你找到公钥文件,比如:

    wget http://your.repo.domain/path/to/RPM-GPG-KEY-endpoint-7 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-endpoint-7

    然后导入它:

    sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-endpoint-7

  3. 再次执行安装命令

    sudo yum install perl-Git


网站公告

今日签到

点亮在社区的每一天
去签到