Ubuntu上手动安装git

1. 先删除本地已经存在的git版本
$ sudo apt-get remove git
2. 下载新版本比如2.7.4版本并编译安装
$ wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.7.4.tar.gz --no-check-certificate
$ tar -xvf git-2.7.4.tar.gz
$ cd git-2.7.4/
$ ./configure prefix=/usr/
$ make prefix=/usr/local/git all
$ sudo make prefix=/usr/local/git install
3. 配置环境变量
将配置export PATH="/usr/local/git/bin":$PATH
添加到文件/etc/profile
最后一行。
$ sudo vim /etc/profile
$ source /etc/profile