【问题标题】:Setting the IP address of github as the origin url将github的IP地址设置为origin url
【发布时间】:2017-08-22 12:41:51
【问题描述】:

我的服务器有 DNS 问题,找不到“Github.com”。我必须改用 Github 的 IP 地址。但是当我尝试像这样使用 IP 地址时:

git remote set-url origin http://192.30.253.113/foo/bar.git

当我尝试推送到原点时,会发生这种情况:

git push origin master

致命:无法访问“https://192.30.253.113/foo/bar.git/”:SSL:证书主题名称(github.com)与目标主机名“192.30.253.113”不匹配

【问题讨论】:

标签: git github ssl-certificate git-remote ubuntu-server


【解决方案1】:

Git pull 不起作用,因为 Git 会验证 SSL 证书并检查主机名是否与证书中的名称匹配。在您的情况下,IP 未包含在证书中,因此您会收到此错误。

一个选项可能是禁用 SSL(如 https://stackoverflow.com/a/16869961/3906760 中所述),但是,这将允许攻击者 MitM 您的连接。

与其禁用 SSL 验证,不如将 github.com 添加到 /etc/hosts(参见https://ubuntuforums.org/showthread.php?t=3407),然后 SSL 证书验证仍然有效。

【讨论】:

  • 谢谢。那行得通。我将 github.com 添加到 /etc/hosts
猜你喜欢
  • 2012-09-23
  • 1970-01-01
  • 1970-01-01
  • 2023-01-28
  • 2011-05-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-09-22
相关资源
最近更新 更多