Centos-610-源码安装GIT
- 安装约定
源码目录 /opt/tools
安装目录 /usr/local/git
- 卸载旧版本GIT
yum remove git -y
- 安装依赖包
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel nss gcc perl-ExtUtils-MakeMaker wget -y
- GIT仓库
https://mirrors.edge.kernel.org/pub/software/scm/git/
- 下载安装
cd /usr/local/src
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.5.tar.xz
tar xf git-2.9.5.tar.xz
cd git-2.9.5
make prefix=/usr/local/git all
make prefix=/usr/local/git install
- 环境配置
vi /etc/profile
在文件底部参照截图进行配置
保持退出
source /etc/profile (使配置生效)
- 安装验证
git --version
显示如截图则说明Git安装成功;若按照失败请根据提示检查相关配置
- git密钥注册
如果是重新注册密钥对,请按照GIT官方说明操作;本文假定你已经用了一份密钥文件。
首先请把你本地的密钥对文件上传至/root/.ssh/目录,详见下图:
id_rsa访问授权,请执行下面命令
chmod 0600 /root/.ssh/id_rsa
git项目文件拉取测试,此处省略。
- GIT常见问题
问题1:The authenticity of host 'gitee.com (xxx.xxx.xxx.xxx)' can't be established
详细描述:
The authenticity of host 'gitee.com (xxx.xxx.xxx.xxx)' can't be established.
ECDSA key fingerprint is SHA256:xxxxxxxxxxxxxxxxxxxxxxxx.
Are you sure you want to continue connecting (yes/no)? //输入yes,回车
Warning: Permanently added 'gitee.com,xxx.xxx.xxx.xxx' (ECDSA) to the list of known hosts.
ssh_packet_read: Connection closed
原因分析:主要是缺少了known_hosts文件,点击yes会自动生成