Git 安装脚本
提供 2 中安装方法
方法1:基于 Git 源码编译安装( centos 7
), 其他版本调整下就可以用了
# 请确保已安装 epel 源,安装 `docbook2X` 时会用到
yum install -y epel-release
# 更新缓存
yum clean all && yum makecache
# 一行命令搞定
wget https://raw.githubusercontent.com/pifeifei/git-install/master/git.sh && sh git.sh v2.23.0 && source /etc/bashrc
# 验证是否安装好
which git
git version
git 使用说明传送门: 点我
安装的时候踩了一些坑, 不过都修复了。
坑1. 提示 template 不存在
- 肿么可能,明明安装了,仔细一看目录不对,后来知道了2 条命令 搞定(是因为安装好后修改 git 安装目录导致)
- touch ~/.gitconfig\
- git config --global init.templatedir "/www/soft/git-v2.23.0/share/git-core/templates"
坑2. 提示 fatal: unable to find remote helper for 'https'
- 百度下, 然后添加 libexec/git-core 目录到 $PATH 即可,试试看!! (还是因为安装好后修改 git 安装目录导致)
- PATH=$PATH:/www/soft/git-v2.23.0/libexec/git-core
坑3、提示:docbook2texi:/book: no description for directory entrydocbook2texi:/book: no description for directory entry
- docbook2texi:/book 是什么意思, 是没有 docbook2texi 命令吗? 我们来创建,再来试试
ln -s /usr/bin/db2x_docbook2texi /usr/bin/docbook2x-texi
ln -s /usr/bin/db2x_docbook2texi /usr/bin/docbook2texi
到这里就搞完了,可以愉快的使用了。
方法2:在处理问题的时候发现有 ius
(Inline with Upstream Stable)
里面有 git
最新版本安装目前没有尝试,使用方法我放出来:
# CentOS 7
wget -O /etc/yum.repos.d/ius.repo https://mirrors.aliyun.com/ius/ius-7.repo
# CentOS 6
wget -O /etc/yum.repos.d/ius.repo https://mirrors.aliyun.com/ius/ius-6.repo
yum clean all
yum makecache
# 查询 git 版本 (url查看:https://repo.ius.io/7/x86_64/packages/g/)
yum search git22
yum install -y git222
# 差了点 2.23.0 版本还没有
以上就是提供的 2 中方法,用哪个请随意。