2017-02-24 118 views
2

我试图克隆一些存储库,但始终得到相同的错误。我在哪里可以找到关于这个错误的更多信息(错误日志文件或类似的东西),或者有人知道什么是错的?无法使用git克隆任何存储库

# 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 

我使用CentOS的6.8和Git 1.7.1 ----------编辑
升级后

GIT中2.12.0我有错误信息:

# 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?) 
+0

作为一个数据点,在CentOS 6.8下使用git 1.7.1,我可以克隆第二个URL而不会出现问题,并且如果将'http://'更改为'https:// '。如果我使用更新版本的'git',问题会完全消失。 – larsks

+0

我尝试更新git到最新版本,但'git clone'不适用于我:/ – MastaBot

回答

3

该错误是HTTPS cloning errors

明确说明根据确切的错误消息,试图在URL中您的用户名,克隆可以帮助:

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

但最好,你应该recompile and install a more recent version of Git

使用Git版本2.12.0,该错误信息是:

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

确保您已安装的证书:

sudo yum reinstall openssl ca-certificates -y 

此修复程序的手动版本是:

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 

另外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/ 
+0

我得到了'致命的:HTTP请求失败',现在我试着重新编译Git – MastaBot

+0

@MastaBot你在你的最新评论中提到已经更新了git到最新的回复,但是你得到了什么错误信息? – VonC

+0

现在我有Git版本2.12.0,现在仍然有错误,现在错误消息是致命的:无法访问'https://github.com/creationix/nvm.git/':SSL CA证书(路径?访问权限?)' – MastaBot

2

可能有多种原因(代理,防火墙,公司策略和更多)。
据我所知github上已经删除的支持,为http,现在只支持https

更改协议,SSH和它没有任何问题的工作。

有关于如何做到这一点非常详细的文件。
https://help.github.com/articles/connecting-to-github-with-ssh/

总结它:

  • 生成ssh密钥本地
    开放GIT-的bash /终端和生成密钥ssh-keygen
  • 复印键cat ~/.ssh/id_rsa.pub
  • 开放的git毂ANS粘贴键在您的配置文件设置下
  • 克隆与ssh url而不是http/https。

登录到您的帐户GitHub的

  • 在任何页面的右上角,点击您的个人资料照片,然后单击设置

enter image description here

  • 在用户设置侧边栏,点击SSH和GPG键

enter image description here

  • 点击新SSH密钥添加SSH密钥

enter image description here

  • 粘贴您的钥匙插入钥匙领域

enter image description here

  • 点击添加SSH密钥

enter image description here

  • 如果出现提示,确认您的GitHub的密码。

enter image description here

+0

在github上添加SSH密钥后我仍然收到相同的错误 – MastaBot

+0

您是否参与了该项目?如果它是一个私人回购,你必须作出贡献来克隆它。 – CodeWizard

+0

我只希望更新我的nvm(节点版本管理器)和所有(或许多指令如何做到这一点''git clone http:// github.com/creationix/nvm.git' – MastaBot