背景
- 因为vscode remote ssh插件需要git的版本较高,而服务器的git版本太低
- gitlab做CI的时候提示git报错
报错
fatal: git fetch-pack: expected shallow list fatal: The remote end hung up unexpectedly ERROR: Job failed: exit status 1
Fetching changes with git depth set to 20... Initialized empty Git repository in /home/gitlab-runner/builds/8MxUksyb/0/gitlab-instance-f410c318/gitlab-ci-k8s-demo/.git/ Created fresh repository. git: 'remote-http' is not a git command. See 'git --help'. ERROR: Job failed: exit status 1
- gitlab的安装
二进制
因为没有外部网络,看了一下rpm包安装依赖太多了,最后决定二进制安装。
安装包
选择需要的版本
https://mirrors.edge.kernel.org/pub/software/scm/git/
make 编译
make prefix=/usr/local/git all • 1
make install安装
make prefix=/usr/local/git install
设置环境变量
vim /etc/profile export GIT_HOME=/usr/local/git export PATH=$GIT_HOME/bin:$PATH
加载环境变量
source /etc/profile • 1