Can't clone any repository using git
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
# 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
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?)
2 Solutions collect form web for “Can't clone any repository using git”
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/
There can be a variety of reasons (proxy, firewall, company policy and more).
As far as i know github has removed the support for the
http and now only support
Change the protocol to ssh and it will work without any problems.
There is a very detailed document on how to do it.
To summarize it:
- Generate ssh key locally
open git-bash/terminal and generate the key
- Copy the key
- open git hub ans paste the key under your profile settings
- Clone with the ssh url instead of the http/https.
Login to your github account
- In the upper-right corner of any page, click your profile photo, then click Settings.
- In the user settings sidebar, click SSH and GPG keys
- Click New SSH key or Add SSH key.
- Paste your key into the Key field.
- Click Add SSH key.
- If prompted, confirm your GitHub password.