Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Properly download from github using wget and curl
wget --no-check-certificate --content-disposition https://github.com/joyent/node/tarball/v0.7.1
# --no-check-cerftificate was necessary for me to have wget not puke about https
curl -LJO https://github.com/joyent/node/tarball/v0.7.1
@guillerglez88
Copy link

guillerglez88 commented Nov 14, 2019

thanks 👍

@littlejeem
Copy link

littlejeem commented Dec 7, 2019

cheers!

@MagicJohnJang
Copy link

MagicJohnJang commented Feb 17, 2020

Work! Amazing

@Darrenzzy
Copy link

Darrenzzy commented May 27, 2020

thx!

@tarpanpathak
Copy link

tarpanpathak commented Jul 24, 2020

Thx!

@OctavioBR
Copy link

OctavioBR commented Aug 4, 2020

For people who like the long, more understandable form of curl options to be used in scripts:

  • -L → --location
  • -J → --remote-header-name
  • -O → --remote-name
curl --location --remote-header-name --remote-name https://github.com/joyent/node/tarball/v0.7.1

@OctavioBR
Copy link

OctavioBR commented Aug 4, 2020

Don't know why --remote-header-name is required. It works fine only with --location & --remote-name

@g0d0
Copy link

g0d0 commented Aug 5, 2020

None of these examples work for me. 404 is returned.

@trylaarsdam
Copy link

trylaarsdam commented Aug 22, 2020

thanks for this!

None of these examples work for me. 404 is returned.

This likely means your URL is invalid (the file isn't on the server)

@dienluong
Copy link

dienluong commented Aug 27, 2020

-J, --remote-header-name

(HTTP) This option tells the -O, --remote-name option to use the server-specified Content-Disposition filename instead of extracting a filename from the URL.

If the server specifies a file name and a file with that name already exists in the current working directory it will not be overwritten and an error will occur. If the server doesn't specify a file name then this option has no effect.

There's no attempt to decode %-sequences (yet) in the provided file name, so this option may provide you with rather unexpected file names.

WARNING: Exercise judicious use of this option, especially on Windows. A rogue server could send you the name of a DLL or other file that could possibly be loaded automatically by Windows or some third party software.

Source: https://curl.haxx.se/docs/manpage.html#-J

Generally, one shouldn't blindly use command options without knowing what they do.

@azmanhamid
Copy link

azmanhamid commented Oct 8, 2020

TQ

@MetaKomora
Copy link

MetaKomora commented Dec 22, 2020

Thank you so much

@DivineAlien
Copy link

DivineAlien commented Jan 21, 2021

nice nice

@arcticOak2
Copy link

arcticOak2 commented Jan 29, 2021

Thank you so much <3

@solankiravi
Copy link

solankiravi commented Feb 9, 2021

None of these examples work for me. 404 is returned.

I think you are trying to clone the private repo. To download private repo you should use a token.

@wook-coder
Copy link

wook-coder commented Feb 10, 2021

TQ

@FASLADODO
Copy link

FASLADODO commented Feb 14, 2021

Thanks

@prasadkudav
Copy link

prasadkudav commented Mar 22, 2021

When I download with this way from github. I get xml file with some metadata, It does not download the actual file.
How to download the actual file ?

@apolopena
Copy link

apolopena commented Mar 30, 2021

When I download with this way from github. I get xml file with some metadata, It does not download the actual file.
How to download the actual file ?

@prasadkudav,
You need to download the raw file which is kept at the domain raw.githubusercontent.com.
So a URL like this:
https://github.com/apolopena/gitpod-laravel8-starter/blob/main/README.md
Would need to be curled from here:
https://raw.githubusercontent.com/apolopena/gitpod-laravel8-starter/main/README.md

@81322068
Copy link

81322068 commented May 18, 2021

thank you!

@richardkeep
Copy link

richardkeep commented May 21, 2021

@jwebcat what about a private repo? How do you pass the token?

@okparaa
Copy link

okparaa commented May 29, 2021

thank you so much

@mkbcodes
Copy link

mkbcodes commented Jul 17, 2021

it doesn't work with me, i tried: wget --no-check-certificate --content-disposition https://github.com/joyent/node/tarball/v0.7.1
Said Unable to establish SSL connection.

@khorramk
Copy link

khorramk commented Sep 25, 2021

Thanks

@taylortaurus
Copy link

taylortaurus commented Oct 15, 2021

thx!

@SalimF
Copy link

SalimF commented Oct 31, 2021

Works solves my server upgrade

@pablodz
Copy link

pablodz commented Nov 9, 2021

What about http connections

@Yuchengw
Copy link

Yuchengw commented Dec 11, 2021

Thanks, it worked as a magic!

@alielmajdaoui
Copy link

alielmajdaoui commented Feb 10, 2022

In a Dockerfile, you can use ADD to download from any source. it's helpful when your image doesn't have curl or wget, or if you can't use https.

Example:

ADD https://github.com/just-containers/s6-overlay/releases/download/v3.1.0.0/s6-overlay-noarch-3.1.0.0.tar.xz /tmp
RUN tar -C / -Jxpf /tmp/s6-overlay-noarch-3.1.0.0.tar.xz

Source: https://github.com/just-containers/s6-overlay#using-cmd

@cchwala
Copy link

cchwala commented May 4, 2022

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment