1.我們在服務器上直接git clone項目的版本庫的時候報401錯誤!
錯誤如下:error: The requested URL returned error: 401 Unauthorized while accessing
原因:git 版本過低
2.git –version 查看一下當前的git版本
因爲centos yum 安裝的git是 1.7.1
所以我們要升級git的版本
3.如何升級git
更新yum: sudo yum update
安裝依賴包:sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
下載git:wget https://github.com/git/git/archive/v2.3.0.zip
解壓然後進入到目錄下
安裝:make prefix=/usr/local/git all
sudo make prefix=/usr/local/git install
4.再執行下git –version看git版本是否升級
如果還是1.7.1 需要修改環境變量
sudo vim /etc/profile
在文件的最後加入:export PATH=/usr/local/git/bin:$PATH
source /etc/profile:應用修改
git –version 切換到了2.3.0
這樣git的命令就可以正常使用了!