Git-v2.35.1的安装与配置
Git官网下载地址
1. 下载安装包和依赖库,解压、检查、编译、安装、删除安装包和解压目录
$ wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.35.1.tar.gz
$ cp git-2.35.1.tar.gz /usr/local/
$ cd /usr/local/
$ tar -zxvf git-2.35.1.tar.gz
$ cd git-2.35.1
$ yum install openssl-devel && yum install curl-devel && yum install expat-devel
$ ./configure --prefix=/usr/local/git
$ make && make install
$ rm -f git-2.35.1.tar.gz
$ rm -rf git-2.35.1/
2. 将git安装路径的环境变量添加到 “/etc/profile
” 文件末尾,然后退出并保存:esc -> :wq
,重载文件,测试版本
# git
export GIT_HOME=/usr/local/git
export PATH=$PATH:$GIT_HOME/bin
$ vim /etc/profile
$ source /etc/profile
$ git --version
3. 创建Git账户
$ git config --global user.name "xxx"
$ git config --global user.email "[email protected]"
$ cd ~/.ssh
$ ls
$ ssh-keygen -t rsa -C "[email protected]"
$ cat id_rsa.pub
创建成功如下图: