最近在我的 linux 系统上,我遇到了无法提交到我自己的 github 存储库的问题。当我尝试这样做时,这就是我得到的:
my prompt: > git push --verbose
Pushing to https://github.com/MyUsername/my-repository.git
info: please complete authentication in your browser...
fatal: The SSL connection could not be established, see inner exception.
fatal: The remote certificate is invalid because of errors in the certificate chain: UntrustedRoot
Username for 'https://github.com':
Password for 'https://github.com':
remote: No anonymous write access.
fatal: Authentication failed for 'https://github.com/MyUsername/my-repository.git/'
发生的事情是我得到一个窗口,要求我登录到 github(通过 Web 界面),我这样做,在我的浏览器中获得“授权成功,返回到您的应用程序”页面 - 在我的应用程序中,我显然可以看到我的机器不信任 github。由于某些原因。
我如何说服它实际上可以建立与 github 的安全连接?
如果这很重要,我的系统是 linux mint。
就我自己而言,使用 SSH 进行 Git 连接比使用 HTTPS 有更好的体验。
为此,您应该创建一个新的 SSH 密钥,最好用密码保护。密钥对由公钥和私钥组成。
~/.ssh/github.pub
~/.ssh/github
您现在可以在GitHub 设置中单击“新建 SSH 密钥”添加公钥。
之后,您必须将新源添加到您的存储库。
通过使用带密钥的 SSH,您不再需要通过浏览器授权 HTTPS 会话的问题。这样你至少可以解决你的错误。
您可能需要更新您的根证书存储库。
如果您使用的是 MITM 代理或有自签名证书或未知证书,请检索签名证书并使用
sslCAInfo
.