不推荐使用YUM安装版本过低,Centos上是git-daemon.x86_64 1.7.1-9.el6_9
源码安装git
解决依赖关系
yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
下载源码包
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.21.0.tar.gz
tar xf git-2.21.0.tar.gz
cd git-2.21.0
make prefix=/usr/local/git all
make prefix=/usr/local/git install
rm -rf /usr/bin/git
ln -s /usr/local/git/bin/git /usr/bin/git
[root@tom01 git-2.21.0]# git --version
git version 2.21.0
创建git仓库
mkdir /git
[root@tom01 /]# cd /git/
[root@tom01 git]# git init
Reinitialized existing Git repository in /git/.git/
[root@tom01 git]# git config --global user.name “test”
[root@tom01 git]# git config --global user.email “xxxxxxx@qq.com”
git config --global color.ui true #语法高亮
[root@tom01 git]# git config --list
user.name=test
user.email=xxxxx@qq.com
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
Git四个区域
远程仓库
本地仓库
暂存区域
工作目录
四种状态