DEV Community

Lyner Lim
Lyner Lim

Posted on

Troubleshooting: curl/wget Fetching HTML Instead of Files

Have you ever tried to download a file using curl or wget, only to end up with an HTML page instead? It’s likely that the URL isn’t pointing directly to the file. Let’s use downloading a file from GitHub as an example.

If you just click on the file like this link (https://github.com/docker/docker-install/blob/master/install.sh), right click to inspect and you will see it is in html.

What we should do is click on the Raw to get this link (https://raw.githubusercontent.com/docker/docker-install/refs/heads/master/install.sh).

Now, wget https://raw.githubusercontent.com/docker/docker-install/refs/heads/master/install.sh or curl -O https://raw.githubusercontent.com/docker/docker-install/refs/heads/master/install.sh will download the install.sh file to your local directory.

Top comments (0)