1.在线
yum install git
2.离线
2.1.下载离线包
从 https://mirrors.edge.kernel.org/pub/software/scm/git/下载 git-2.28.0.tar.gz
mkdir -p /home/soft/git
cd /home/soft/git
tar -zxf git-2.28.0.tar.gz
2.2.下载依赖 https://pkgs.org/search/
zlib-1.2.7-18.el7.x86_64.rpm
zlib-devel-1.2.7-18.el7.x86_64.rpm
libssh2-1.8.0-3.el7.x86_64.rpm
libcurl-7.29.0-57.el7.x86_64.rpm
curl-7.29.0-57.el7.x86_64.rpm
libcurl-devel-7.29.0-57.el7.x86_64.rpm
2.3.安装依赖
rpm -Uvh zlib-1.2.7-18.el7.x86_64.rpm
rpm -Uvh zlib-devel-1.2.7-18.el7.x86_64.rpm
rpm -Uvh libssh2-1.8.0-3.el7.x86_64.rpm
rpm -Uvh libcurl-7.29.0-57.el7.x86_64.rpm
rpm -Uvh curl-7.29.0-57.el7.x86_64.rpm
rpm -Uvh libcurl-devel-7.29.0-57.el7.x86_64.rpm
2.4.安装 git
cd /home/soft/git/git-2.28.0
./configure --prefix=/usr/local/git
make && make install
2.5.配置环境变量
vim /etc/profile
export GIT_PATH=/usr/local/git/bin
export PATH=PATH:GIT_PATH
source /etc/profile
ln -s /usr/local/git/bin/git /bin/git
验证:git --version
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于