设置证书验证位置时出错 - Github

Jun*_*aid 11 git bash ssl github

我在通过Git Bash访问 github 存储库时遇到问题。

2 天前,我能够推/拉存储库。然后

1)我在gitlab.com上创建了一个帐户

2)我在我的本地电脑上使用GitLab 和 SSH 密钥在 Windows 上使用git bash生成了 ssh 密钥

3)在此之后,我没有在 gitlab 上创建/拉/推任何存储库。

今天,我对代码(部署在 github 上)进行了一些更改,当我尝试推送该代码时,出现以下错误

fatal: unable to access 'https://github.com/junaidbinsarfraz/repo.git/': error setting certificate verify locations:
  CAfile: E:/Softwares/Git/mingw64/libexec/ssl/certs/ca-bundle.crt
  CApath: none
Run Code Online (Sandbox Code Playgroud)

libexec 中没有ssl文件夹

libexec 文件夹

自 2017 年 1 月以来,Git 文件夹中的文件/文件夹也没有更改

在此处输入图片说明

似乎是 git-bash 问题,不确定。任何人都可以帮忙吗?

小智 40

name就我而言,在 Windows 上,设置以及e mailgit config 的证书路径后它不起作用。从命令提示符运行以下命令修复了此问题。

git config --global http.sslcainfo "C:\Program Files\Git\usr\ssl\certs\ca-bundle.crt"

您的路径ca-bundle.crt可能因您的情况而异。


Von*_*onC 5

首先,创建 ssh 密钥对 HTTPS url 没有帮助。
让那些键,但如果你想使用它们,你就需要把现有的SSH密钥到您的github帐户,然后

 cd /path/to/your/repo
 git remote set-url origin git@github.com:junaidbinsarfraz/repo.git
 git push
Run Code Online (Sandbox Code Playgroud)

其次,关于证书错误,尝试从一个简单的 CMD 推送,使用简化的 PATH ,就像我在这里所做的那样,所述 PATH 引用最新的 Git for Windows
为此,请PortableGit-2.16.1-64-bit.7z.exe在您想要的任何位置解压缩。

  • @Junaid然后将你的公钥添加到你的GitHub帐户,我的答案将起作用:https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/。只需使用不带密码的 SSH 密钥,以避免给 ssh 代理带来麻烦。 (2认同)