git fatal:拒绝使用缺少主机字段的凭据

发布于 2025-01-10 11:18:09 字数 1143 浏览 0 评论 0原文

克隆 git 存储库时出现错误 致命:拒绝使用缺少主机字段的凭据

早些时候,我收到了 ssl 握手错误,因此,在 git 配置文件中添加以下内容后,现在我遇到了提到的致命错误。

    sslCert = ~/xyz.crt
    sslKey = ~/xyz.key
    sslVerify = false
    sslCertPasswordProtected = false

我也尝试通过添加以下内容来添加,但没有成功:

[url "https://hostname"]
    insteadOf = git://hostname

git credential批准

protocol=https
host=www.abc.com
username=yuyiuyiuy
password=78yhkjh



warning: ----------------- SECURITY WARNING ----------------
warning: | TLS certificate verification has been disabled! |
warning: ---------------------------------------------------
warning: HTTPS connections may not be secure. See https://aka.ms/gcm/tlsverify for more information.
warning: failed to probe 'http(s)://www.abc.com/' to detect provider
warning: An error occurred while sending the request.
warning: see https://aka.ms/gcm/autodetect for more information.

此外,如下使用


protocol=https
host=www.abc.com
username=yuyiuyiuy
password=78yhkjh
url=<git repo path>

致命:拒绝使用凭据缺少主机字段

While cloning git repository, I am getting error
fatal: refusing to work with credential missing host field

Earlier i was getting ssl handshake error so, after adding below in git configuration file, now i am stuck with mentioned fatal error.

    sslCert = ~/xyz.crt
    sslKey = ~/xyz.key
    sslVerify = false
    sslCertPasswordProtected = false

also i tried adding by adding below but no success:

[url "https://hostname"]
    insteadOf = git://hostname

git credential approve

protocol=https
host=www.abc.com
username=yuyiuyiuy
password=78yhkjh



warning: ----------------- SECURITY WARNING ----------------
warning: | TLS certificate verification has been disabled! |
warning: ---------------------------------------------------
warning: HTTPS connections may not be secure. See https://aka.ms/gcm/tlsverify for more information.
warning: failed to probe 'http(s)://www.abc.com/' to detect provider
warning: An error occurred while sending the request.
warning: see https://aka.ms/gcm/autodetect for more information.

Also, used as below


protocol=https
host=www.abc.com
username=yuyiuyiuy
password=78yhkjh
url=<git repo path>

fatal: refusing to work with credential missing host field

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

深海少女心 2025-01-17 11:18:09

这帮助了我:

...
[http]
    sslbackend = openssl
...

This helped me:

...
[http]
    sslbackend = openssl
...
ま柒月 2025-01-17 11:18:09

对于 MacOS 上的我来说,当我尝试将 .gitconfig 文件重命名为 .xgitconfig (或者只是删除 git 的全局配置文件)时,一切都很顺利,并且通过 HTTPS 克隆远程存储库工作正常。

For me on MacOS, when I tried to rename the .gitconfig file to .xgitconfig (or just delete the global config file of git), then everything went fine, and cloning the remote repo via HTTPS worked fine.

雄赳赳气昂昂 2025-01-17 11:18:09

我认为有几个因素可能会导致此错误。当 sslCert 和 sslKey 的路径中有拼写错误时,我看到了此错误。

  1. 验证路径是否正确且可读。
  2. 验证证书尚未过期。
  3. 验证证书的格式是否正确。
  4. 验证证书是否不受密码保护。

I think there are several things that can go wrong that can cause this error. I have seen this error when I had a typo in the paths for sslCert and sslKey.

  1. Verify that the paths are correct and readable.
  2. Verify that the certificates have not expired.
  3. Verify that the certificates are the correct format.
  4. Verify that the certificates are not password protected.
旧话新听 2025-01-17 11:18:09

只需从“.gitconfig”中删除相对路径

sslCert = /fullpath/xyz.crt
sslKey = /fullpath/xyz.key

Just remove the Relative Paths from your ".gitconfig"

sslCert = /fullpath/xyz.crt
sslKey = /fullpath/xyz.key
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文