CentOS 7 编译安装最新版git
安装wget
yum install wget -y
下载最新版本的git源码,并解压
cd /usr/local/src/ wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz tar xvf git-2.9.5.tar.gz cd git-2.9.5
安装依赖包,用于编译
yum groupinstall 'Development Tools'
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-CPAN perl-devel
配置
ake configure
./configure
编译
make
安装
make install
配置git命令补全
将源码目录下的文件复制到/etc/bash_completion.d/目录下。
cp contrib/completion/git-completion.bash /etc/bash_completion.d/
加载文件
. /etc/bash_completion.d/git-completion.bash
将配置加进配置文件末尾
vim /etc/profile
if [ -f /etc/bash_completion.d/git-completion.bash ]; then . /etc/bash_completion.d/git-completion.bash fi
读取配置
. /etc/profile
配置完成,可以检查git命令补全是否生效