Git无法连接Gitlab,SSH验证错误

标签 git ssh gitlab ssh-keys

我一直在尝试使用 SSH key 从 Gitlab 中提取存储库。所有这些都通过 Ubuntu VM 在 Windows 8 上的命令行中完成。我已将我的公钥添加到我的 Gitlab 帐户,然后将我的私钥添加到 ssh-agent,这样做似乎没有任何错误,但是当我尝试执行 git pull 或 push 时,我遇到了这个问题错误;

fatal: unable to access 'https://git.mgmt.local/XXX/project-name.git/': 
server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none

这让我直接撞到了墙上......不知道出了什么问题,有人能指出我正确的方向吗?

最佳答案

那是因为您使用的是 https 网址。

Https 表示不使用存储在 %HOME%.ssh 中的公钥和私钥。完全没有。

尝试切换到 ssh url:

git remote set-url origin (user)@(ip address):(group)/(project).git

使用标准 GitLab 安装 (user)应该是 git .

您可以先检查 ssh 是否正在使用:
ssh -Tvvv git@your_server.com

关于Git无法连接Gitlab,SSH验证错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28783072/

相关文章:

git - 使用非标准端口号将 SSH 存储库克隆到 SourceTree

git - 使用 GitHub 存储库和 SSH 登录的 Spring Boot 配置服务器

git - 我可以为 Travis YAML 配置命令创建 ALIAS 吗? ... "travis encrypt GITHUB_TOKEN=****** --add"?

linux - SSH 进入树莓派

git - 如何使用 ssh key 更改 git commit 的作者

git - 递归忽略特定目录中除 .json 文件之外的所有文件

linux - 即使在创建时,vagrant 也永远无法 ssh 到我的 ubuntu 盒子。

git - 如何使 git push 与 Cygwin 一起工作?

gitlab - 如何将多个应用程序部署到单个 Gitlab 托管集群?

GitLab CI - 如果变量存在设置变量