git同步遇到报错


git同步遇到报错

“fatal: unable to access ‘https://github.com/ruanwenwu/newp.git/‘: Peer reports incompatible or unsupported protocol version.”

网上很多人说是因为git版本需要升级。我将git版本升级到最新的2.16版本,

git的升级:

CentOS 上的最新git版本也只有1.8.3,就想试着装上最新的版本,没想到差点玩脱,全当记录一次冒险经历

  • Development tools 没装的要装上,不然GCC编译时会出错
# yum -y groupinstall Development tools
  • GCC 用于编译安装包
# yum install gcc perl-ExtUtils-MakeMaker
  • 再卸载CentOS自带的老版本git
# yum -y remove git

下载git并安装

# cd /usr/src
# wget https://www.kernel.org/pub/software/scm/git/git-2.12.0.tar.gz
# tar xzf git-2.12.0.tar.gz

安装注意事项:

# cd git-2.12.0
# make prefix=/usr/local/git all

此时报错

/usr/src/git-2.12.0/utf8.c:463:对‘libiconv’未定义的引用
libgit.a(utf8.o):在函数‘reencode_string_len’中:
/usr/src/git-2.12.0/utf8.c:524:对‘libiconv_open’未定义的引用
/usr/src/git-2.12.0/utf8.c:535:对‘libiconv_close’未定义的引用
/usr/src/git-2.12.0/utf8.c:529:对‘libiconv_open’未定义的引用
collect2: 错误:ld 返回 1
make: *** [git-credential-store] 错误 1

原方案:

# make prefix=/usr/local/git all
# make prefix=/usr/local/git install

解决方案:

     可替换为

# ./configure --without-iconv
# make CFLAGS=-liconv prefix=/usr/local/git all
# make CFLAGS=-liconv prefix=/usr/local/git install

最后将git加入环境变量

# echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
# source /etc/bashrc
在/etc/profile里加入

export PATH=$PATH:/usr/libexec/git-core
source /etc/profile


[root@iZ25lzba47vZ tp5test]# git --version
git version 2.12.0

问题却依然存在。最后更新了一下nss 问题解决了

最后:

yum update -y nss curl libcurl

问题解决了。

原文地址:https://www.cnblogs.com/houchaoying/p/9002042.html