环境:
RHEL7 yum源配置完毕
关闭SELINUX、防火墙
1.下载安装git
#安装
root@mysqlslave1 ~# wget https://dl.iuscommunity.org/pub/ius/stable/CentOS/7/x86_64/ius-release-1.0-15.ius.centos7.noarch.rpm
root@mysqlslave1 ~# yum install ius-release-1.0-15.ius.centos7.noarch.rpm -y
从 file:///etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY 检索密钥
导入 GPG key 0x9CD4953F:
用户ID : "IUS Community Project <coredev@iuscommunity.org>"
指纹 : 8b84 6e3a b3fe 6462 74e8 670f da22 1cdf 9cd4 953f
软件包 : ius-release-1.0-15.ius.centos7.noarch (installed)
来自 : /etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY
git2u-core-doc-2.16.5-1.ius.el7.noarch.rpm 的公钥尚未安装
失败的软件包是:git2u-core-doc-2.16.5-1.ius.el7.noarch
GPG 密钥配置为:file:///etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY
公钥检查失败,修改 /etc/yum.conf 文件
root@mysqlslave1 ~# vim /etc/yum.conf
#关闭密钥检查
gpgcheck=0
再次尝试安装
root@mysqlslave1 ~# yum install git2u -y
Downloading packages:
警告:/var/cache/yum/x86_64/7Server/ius/packages/git2u-core-doc-2.16.5-1.ius.el7.noarch.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 4b274df2: NOKEY
从 file:///etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY 检索密钥
源 "IUS Community Packages for Enterprise Linux 7 - x86_64" 的 GPG 密钥已安装,但是不适用于此软件包。请检查源的公钥 URL 是否配置正确。
失败的软件包是:git2u-core-doc-2.16.5-1.ius.el7.noarch
GPG 密钥配置为:file:///etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY
修改 /etc/yum.repos.d/ius.repo 文件,关闭密钥检查
root@mysqlslave1 ~# vim /etc/yum.repos.d/ius.repo
#将gpgcheck=0改为gpgcheck=1 或执行 :%s/gpgcheck=1/gpgcheck=0/g
再次尝试安装
root@mysqlslave1 ~# yum install git2u -y
已安装:
git2u.x86_64 0:2.16.5-1.ius.el7
作为依赖被安装:
git2u-core.x86_64 0:2.16.5-1.ius.el7
git2u-core-doc.noarch 0:2.16.5-1.ius.el7
git2u-perl-Git.noarch 0:2.16.5-1.ius.el7
libsecret.x86_64 0:0.18.6-1.el7
perl-Error.noarch 1:0.17020-2.el7
perl-TermReadKey.x86_64 0:2.30-20.el7
完毕!
2.初始化配置git
安装后首先要设置用户名和邮箱
root@mysqlslave1 ~# git config --global user.name "syh7687"
root@mysqlslave1 ~# git config --global user.email "syh7687@gmail.com"
查看设置
root@mysqlslave1 ~# git config --global --list
user.name=syh7687
user.email=syh7687@gmail.com