Reputation: 995
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
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
Reputation: 1
Just remove the Relative Paths from your ".gitconfig"
sslCert = /fullpath/xyz.crt
sslKey = /fullpath/xyz.key
Upvotes: 0
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.
Upvotes: 0
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