user890234
user890234

Reputation: 995

git fatal: refusing to work with credential missing host field

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

Upvotes: 3

Views: 20026

Answers (5)

Andrushenko Alexander
Andrushenko Alexander

Reputation: 1973

I had same error on my Windows PC that uses proxy. I have taken the .gitconfig file from my Linux machine where GIT worked fine, and tried to use the same configuration file for GIT on Windows, of course after adjusting paths in the file. I placed the .gitconfig under "C:\Users\MyUser\.gitconfig" on Windows but was unable to clone the sources on Windows. When I deleted the .gitconfig file on Windows and tried to clone the project in new GIT console, it worked!

So, GIT on Windows uses gitconfig file located under GIT intallation path, in my case under "C:\Program Files\Git\etc\gitconfig". Somehow locatig .gitconfig under "C:\Users\MyUser\.gitconfig" prevented GIT from using the proper configuration. The fix worked.

Upvotes: 0

WerIstDominik
WerIstDominik

Reputation: 1

Just remove the Relative Paths from your ".gitconfig"

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

Upvotes: 0

OfNothing
OfNothing

Reputation: 600

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.

Upvotes: 0

Zakaria
Zakaria

Reputation: 1085

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.

Upvotes: 0

Igor Mukhin
Igor Mukhin

Reputation: 15368

This helped me:

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

Upvotes: 3

Related Questions