Centos8.2 中 Git 安装

一、安装依赖包

1
2
系统为 centos8.2 版本,可能会出现系统版本不兼容等问题!
sudo yum -y install make autoconf automake cmake perl-CPAN libcurl-devel libtool gcc gcc-c++ glibc-headers zlib-devel git-lfs telnet ctags lrzsz jq expat-devel openssl-devel

二、安装新版git包

1
2
3
4
5
6
7
8
9
cd /tmp
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.30.2.tar.gz
tar -xvzf git-2.30.2.tar.gz
cd git-2.30.2/
./configure
make
sudo make install
git --version # 输出 git 版本号,说明安装成功
git version 2.30.2

三、

一些操作

1
2
3
4
5
6
7
8
9
10
11
12
13
 git config --global user.name "chaggle"  用户名改成自己的
git config --global user.email "chaggle@foxmail.com" 邮箱改成自己的
git config --global credential.helper store
git config --global core.longpaths true

# 在 Git 中,我们会把非 ASCII 字符叫做 Unusual 字符。这类字符在 Git 输出到终端的时候默认是用 8 进制转义字符输出的(以防乱码),但现在的终端多数都支持直接显示非 ASCII 字符,所以我们可以关闭掉这个特性
git config --global core.quotepath off

# 访问 github.com 太慢,可以通过国内 GitHub 镜像网站来访问
git config --global url."https://gitclone.com/".insteadOf "https://"

# GitHub 限制最大只能克隆 100M 的单个文件,为了能够克隆大于 100M 的文件,我们还需要安装 Git Large File Storage
git lfs install --skip-repo

四、Github 代理配置

这里博主为了稳定性考虑,只推荐 https://gitclone.com 网站,其余的代理都容易失效

1
2
3
4
#原地址
git clone https://github.com/kubernetes/kubernetes.git
#改为
git clone https://gitclone.com/github.com/kubernetes/kubernetes.git

但是提交git仓储时候,需要将代理地址进行还原,否则就会上传到代理地址的 git 地址!


Centos8.2 中 Git 安装
https://chaggle.github.io/2021/10/15/middleware/git/
作者
chaggle
发布于
2021年10月15日
许可协议