进入到cd /usr/local
cd /usr/local
下载git
wget https://www.kernel.org/pub/software/scm/git/git-2.31.0.tar.gz
解压安装包
tar -zxvf git-2.31.0.tar.gz
安装依赖
yum -y install gcc openssl openssl-devel curl curl-devel unzip perl perl-devel expat expat-devel zlib zlib-devel asciidoc xmlto gettext-devel openssh-clients
在/usr/local下创建git目录
mkdir git
进入到解压下的git目录
cd git-2.31.0/
编译
make prefix=/usr/local/git all doc
安装:make prefix=/usr/local/git install
make prefix=/usr/local/git install
配置环境变量 vim /etc/profile
底部追加 export PATH=/usr/local/git/bin:$PATH
使更新生效
source /etc/profile
查看安装是否成功 git --version
设置用户
git config --global user.name "名称"
设置邮箱
git config --global user.email "邮箱"
设置公钥私钥
ssh-keygen -C '997832221@qq.com' -t rsa
进入公钥私钥目录
cd /root/.ssh