Centos使用git push代碼時報錯(The requested URL returned error: 400),環境爲centos6、git1.7.1。
Coding文檔提示git version低於1.9可能會報錯,遂升級git至最新版。
由於CentOS用yum安裝的版本只有1.x,故需要手動編譯安裝。
首先,下載git安裝包。
從github上下載一個最新版(撰寫文章時的最新版爲:2.6.0)。
cd /usr/local/src wget https://github.com/git/git/archive/master.zip
unzip master.zip
由於系統中已存在git,所以先備份現有git。
mv /usr/bin/git{,.bak}
編譯安裝
cd /usr/local/src/git-master
make configure
./configure --prefix=/usr/bin
make && make install
拷貝到原有Git所在位置
cp /usr/local/src/git-master/git /usr/bin