方式一:yum
1)安裝git:#yum -y install git
2)查看版本:#git --version
由於yum方式安裝的git版本太老,一般不推薦。
3)卸載git:yum -y remove git
方式二:源碼安裝
1)下載源碼:#wget https://github.com/git/git/archive/v2.17.0.tar.gz
2)解壓:#tar -zxvf v2.17.0.tar.gz
3)安裝依賴包:#yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
注意:安裝依賴時,會默認以yum方式安裝 git,我們需要手動卸載
4)編譯:#cd git-2.17.0 ; #make prefix=/usr/local/git all
5)安裝git至指定目錄:#make prefix=/usr/local/git install
6)配置環境變量:#vim /etc/profile
7)重新加載:#source /etc/profile
8)查看版本:#git --version
配置SSH
1)本地生成key #ssh-keygen -t rsa -C "404597513@qq.com"
2)查看生成的key #cat cat ~/.ssh/id_rsa.pub
3)在github個人賬戶配置key