Could not resolve host: github.com ONLY in windows bash
bash, git, windows-subsystem-for-linux
Solution
It could be that your `/etc/resolv.conf` file is corrupt - it happened to me!
Symptoms are:
- Inside WSL `/etc/resolv.conf` is not plain text but some binary garbage. It should be plain text.
- You cannot e.g. `ping google.com` or `ping stackoverflow.com` from inside WSL.
- You can ping those domains OK from powershell in the windows host. Windows git also works OK.
Aside: Interestingly `ping github.com` fails for me today on all my machines but that doesn't stop me from visiting github in my browser or using git - strange.
The solution is to `sudo rm /etc/resolv.conf` and restart WSL - windows will recreate that file for you and you should be able to ping away and use git once more from within WSL.
To restart WSL - open a Powershell terminal in Administrator mode and run the following commands. (taken from @germa-vinsmoke 's answer)
wsl --shutdown
Get-Service LxssManager | Restart-Service
Problem
I have installed ubuntu 18.04(WSL) in my win 10 64 bit, 1903. For the command `git clone https://github.com/facebookresearch/fastText.git`, it works well in `git bash`(git for windows) and `ubuntu 18.04` shell but not in `bash` (C:\Windows\System32\bash.exe), the error message is ``` $ git clone https://github.com/facebookresearch/fastText.git Cloning into 'fastText'... fatal: unable to access 'https://github.com/facebookresearch/fastText.git/': Could not resolve host: github.com ``` I have only two `.gitconfig` file in my pc, one for `git bash` and another for `ubuntu 18.04` shell. I think `ubuntu 18.04` shell may equal to `bash` in some degree but the `bash` must have problems.