1、下载解压 git 源代码
curl -O https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.37.2.tar.gz tar -xvf git-2.37.2.tar.gz cd git-2.37.2
2、安装依赖包
yum install -y gcc curl-devel openssl-devel zlib-devel
3、编译安装 git
./configure --prefix=/usr/local/git make -j $(nproc) make install
4、git 命令补全设置
cd ./contrib/completion cp git-completion.bash git-prompt.sh /etc/profile.d/ ln -s /etc/profile.d/git-completion.bash /etc/profile.d/git-completion.sh cat << 'EOF' > /etc/profile.d/git.sh export GIT_PS1_SHOWDIRTYSTATE=1 export GIT_PS1_SHOWSTASHSTATE=1 export GIT_PS1_SHOWUNTRACKEDFILES=1 export GIT_PS1_SHOWUPSTREAM="verbose git svn" export GIT_HOME=/usr/local/git export PATH=$PATH:$GIT_HOME/bin EOF
5、定制 git 命令提示符
cat << 'EOF' >> /etc/bashrc export PS1='\[\e[1;32m\][\u@\h \W \[\033[1;31m\]$(__git_ps1 "(%s)")\[\e[1;32m\]]\$ \[\e[0m\]' EOF
via:https://www.cnblogs.com/outsrkem/p/13336810.html
标签:completion,git,etc,编译,GIT,export,PS1,源码 From: https://www.cnblogs.com/nihaorz/p/16617081.html