Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't clone any repository using git

Tags:

git

centos

I tried cloning a few repositories, but always get the same error. Where can I find some more information about this error (an error log file or something similar) or maybe someone knows what can be wrong?

# git clone http://github.com/creationix/nvm.git .nvm
Initialized empty Git repository in /home/marcin/.nvm/.git/
error:  while accessing http://github.com/creationix/nvm.git/info/refs

fatal: HTTP request failed

or

# git clone https://gitlab.com/jmis/exilecraft.git
Initialized empty Git repository in /home/marcin/exilecraft/.git/
error:  while accessing https://gitlab.com/jmis/exilecraft.git/info/refs

fatal: HTTP request failed

I'm using CentOS 6.8 and Git 1.7.1

---------- EDIT
after upgrade Git to 2.12.0 I have error message:

# git clone https://github.com/creationix/nvm.git .nvm
Cloning into '.nvm'...
fatal: unable to access 'https://github.com/creationix/nvm.git/': Problem with the SSL CA cert (path? access rights?)  
like image 304
MastaBot Avatar asked Aug 03 '26 05:08

MastaBot


1 Answers

That error is clearly described in HTTPS cloning errors

Depending on the exact error message, trying to clone with your username in the url can help:

git clone https://<username>@github.com/<username>/<repo.git>

But ideally, you should recompile and install a more recent version of Git.

With Git version 2.12.0, the error message is:

fatal: unable to access 'https://github.com/creationix/nvm.git/': 
Problem with the SSL CA cert 

Make sure you have installed the certificates:

sudo yum reinstall openssl ca-certificates -y

The manual version of this fix is:

mkdir -p /etc/pki/tls/certs
curl https://curl.haxx.se/ca/cacert.pem -o /etc/pki/tls/ca-bundle.crt
git config --global http.sslcainfo /etc/pki/tls/ca-bundle.crt
git config -l 

Another approach is described here:

mkdir /usr/src/ca-certificates && cd /usr/src/ca-certificates
wget http://mirror.centos.org/centos/6/os/x86_64/Packages/ca-certificates-2015.2.6-65.0.1.el6_7.noarch.rpm
rpm2cpio ca-certificates-2015.2.6-65.0.1.el6_7.noarch.rpm | cpio -idmv
cp -pi ./etc/pki/tls/certs/ca-bundle.* /etc/pki/tls/certs/

Note: edtech adds in the comments:

Upgrading the nss package ( yum update nss ) has solved the same problem for me.

like image 93
VonC Avatar answered Aug 05 '26 07:08

VonC