在Go项目中go get的时候遇到以下错误
/src/github.com/lib/pq/.git/
error: while accessing https://github.com/lib/pq/info/refs
fatal: HTTP request failed
网上找了才知道原来是CentOs自带下载的git版本太低,
只好将git更新一下
1)安装依赖:
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc
yum install gcc
2) 卸载原来旧版本
yum remove git
3) 安装最新版本 可在https://mirrors.edge.kernel.org/pub/software/scm/git/上面获取最新git版本
cd /usr/local/src/
wget https://mirrors.edge.kernel.org/pub/software/ scm/git/git-2.18.0.tar.xz
tar -vxf git-2.18.0.tar.xz
make prefix=/usr/local/git all
make prefix=/usr/local/git install
echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/profile
source /etc/profile
在这里make prefix的时候 如果没有安装gcc会报以下错误
GIT_VERSION = 2.18.0
* new build flags
CC credential-store.o
/bin/sh: cc: command not found
4)查看git版本
git --version
更新好后就解决了fatal: HTTP request failed,error: while accessing这个错误;
但是但我接着go get的时候又遇到了以下这个错误。
fatal: unable to access 'https://github.com/lib/pq/': SSL connect error
package github.com/lib/pq: exit status 128
需要安装相应的库
yum update -y nss curl libcurl
参考: centos下升级git版本的操作记录 https://www.cnblogs.com/kevingrace/p/8252517.html
git clone 报错SSL connect error https://blog.csdn.net/lixuande19871015/article/details/80420940