Skip to content

Instantly share code, notes, and snippets.

@jwebcat
Forked from lemenkov/gist:1674929
Last active March 26, 2026 23:26
Show Gist options
  • Select an option

  • Save jwebcat/5122366 to your computer and use it in GitHub Desktop.

Select an option

Save jwebcat/5122366 to your computer and use it in GitHub Desktop.
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
@OctavioBR
Copy link
Copy Markdown

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

@g0d0
Copy link
Copy Markdown

g0d0 commented Aug 5, 2020

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

@trylaarsdam
Copy link
Copy Markdown

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
Copy Markdown

-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
Copy Markdown

TQ

@MetaKomora
Copy link
Copy Markdown

Thank you so much

@DivineAlien
Copy link
Copy Markdown

nice nice

@arcticOak2
Copy link
Copy Markdown

Thank you so much <3

@solankiravi
Copy link
Copy Markdown

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
Copy Markdown

TQ

@FASLADODO
Copy link
Copy Markdown

Thanks

@prasadkudav
Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown

thank you!

@richardkeep
Copy link
Copy Markdown

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

@okparaa
Copy link
Copy Markdown

okparaa commented May 29, 2021

thank you so much

@mleonardblair
Copy link
Copy Markdown

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
Copy Markdown

Thanks

@taylortaurus
Copy link
Copy Markdown

thx!

@SalimF
Copy link
Copy Markdown

SalimF commented Oct 31, 2021

Works solves my server upgrade

@pablodz
Copy link
Copy Markdown

pablodz commented Nov 9, 2021

What about http connections

@Yuchengw
Copy link
Copy Markdown

Thanks, it worked as a magic!

@alielmajdaoui
Copy link
Copy Markdown

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
Copy Markdown

cchwala commented May 4, 2022

๐Ÿ‘

@showgood163
Copy link
Copy Markdown

Thanks!

@vancuongdbj
Copy link
Copy Markdown

Verify Github on Galxe. gid:S8JDzMFPiU7U23PJjf3RMJ

@NHLOCAL
Copy link
Copy Markdown

NHLOCAL commented Oct 17, 2022

ื”ื’ืขืชื™ ืœื–ื” ื“ื•ืงื ื“ืจืš ื’ื•ื’ืœ ื•ืขื•ื‘ื“ ืžืฆื•ื™ืŸ!

@basejumpa
Copy link
Copy Markdown

I was stuck and your curl line just helped me. Thx!

@cig0
Copy link
Copy Markdown

cig0 commented Nov 21, 2023

Thx!

@00unkn0wn00
Copy link
Copy Markdown

Could You Show how to do it on a self hosted git server?

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