我在本地网络中的服务器上安装了gitlab,并使用其IP(192.168.x.y)的自签名SSL证书在某个端口p上侦听。
从服务器克隆存储库时,我可以暂时忽略SSL验证:
git -c http.sslVerify=false clone https://192.168.x.y:p/path/to/repo.git
现在,当使用原始地址(例如git pull origin
)时,由于可能存在MitM攻击,我不想忽略SSL验证。这就是为什么我将证书包含在本地git配置中的原因:
git config http.sslCAInfo /etc/gitlab/ssal/192.168.x.y.crt
git pull origin
现在不再抱怨无法验证证书,而是发出主题名称与主机名不匹配的问题:
fatal: unable to access 'https://192.168.x.y:p/path/to/repo.git/': SSL: certificate subject name (192.168.x.y) does not match target host name '192.168.x.y'
但是我多次检查它们是否完全匹配。不能在git中对本地IP使用自签名证书吗?