git clone時錯誤解決方案

錯誤信息

error: The requested URL returned error: 401 Unauthorized while accessing https://git.oschina.net/zemo/demo.git/info/refs
fatal: HTTP request failed

解決方案

1、安裝依賴

[root@localhost ~]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc
[root@localhost ~]# yum install  gcc perl-ExtUtils-MakeMaker

2、卸載系統自帶的底版本git(1.7.1)

[root@localhost ~]# git --version
git version 1.7.1
[root@localhost ~]# yum remove git

3、編譯安裝最新的git版本

[root@localhost ~]# cd /soft/      進入下載文件的目錄
[root@localhost soft]# wget https://www.kernel.org/pub/software/scm/git/git-2.15.1.tar.xz
[root@localhost soft]# tar -vxf git-2.15.1.tar.xz
[root@localhost soft]# cd git-2.15.1
[root@localhost git-2.15.1]# make prefix=/git all    編譯  prefix指定目錄
[root@localhost git-2.15.1]# make prefix=/git install    安裝  prefix指定目錄
[root@localhost git-2.15.1]# echo "export PATH=$PATH:/git/bin" >> /etc/profile    設置環境變量
[root@localhost git-2.15.1]# source /etc/profile    保證環境變量立即生效

4、查看最新的git版本

[root@localhost ~]# git --version
git version 2.15.1
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章