git request error 401

1. We reported a 401 error when we directly git cloned the repository of the project on the server!

错误如下:error: The requested URL returned error: 401 Unauthorized while accessing

Reason: git version is too low

 

2.git –version View the current git version

Because the git installed by centos yum is 1.7.1

So we have to upgrade the version of git

 

3. How to upgrade git

Update yum: sudo yum update

Install dependencies: sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker

Download git:wget https://github.com/git/git/archive/v2.3.0.zip

Unzip and go to the directory

安装:make prefix=/usr/local/git all

sudo make prefix=/usr/local/git install

 

4. Execute git –version again to see if the git version is upgraded

If it is still 1.7.1, you need to modify the environment variables

sudo vim /etc/profile

Add at the end of the file: export PATH=/usr/local/git/bin:$PATH

source /etc/profile: apply modifications

git --version switched to 2.3.0

In this way, git commands can be used normally!

 

 

                        ps: repost only for your own records

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326064278&siteId=291194637