How to download source in ZIP format from GitHub? [duplicate]
Asked Answered
R

15

293

I see something strange like:

http://github.com/zoul/Finch.git

Now I'm not that CVS, SVN, etc. dude. When I open that in the browser it tells me that I did something wrong. So I bet I need some hacker-style tool? Some client?

(I mean... why not just provide a ZIP file? Isn't the world complex enough?)

Rick answered 1/5, 2010 at 19:6 Comment(0)
E
203

To clone that repository via a URL like that: yes, you do need a client, and that client is Git. That will let you make changes, your own branches, merge back in sync with other developers, maintain your own source that you can easily keep up to date without downloading the whole thing each time and writing over your own changes etc. A ZIP file won't let you do that.

It is mostly meant for people who want to develop the source rather than people who just want to get the source one off and not make changes.

But it just so happens you can get a ZIP file as well:

Click on http://github.com/zoul/Finch/ and then click on the green Clone or Download button. See here:

enter image description here

Experimental answered 1/5, 2010 at 19:15 Comment(5)
Is there any way not to have to download the entire repository? Say, if the repository is a "plugins" repo and you only want one plugin?Lundy
not without using the Github API as far as I know.Janettjanetta
No such button at that URL. In fact the content at that URL looks nothing like your screenshot. Was the zip download function removed from GitHub?Sprite
@Sprite the green button is still there, but it's now labelled "Code". Just click that green button then click "Downlad ZIP"Corporeity
Thanks. Not sure how I missed that it was under "Code"!Sprite
T
251

What happens when the repository owner has not prepared a zip file, and you just want a download to use yourself? There is an answer and you don't need to go though that horrid process to download software, install and register keys and whatnot on GitHub, etc.!

To simply download a repository as a zip file: add the extra path '/zipball/master/' to the end of the repository URL and voila, it gives you a zip file of the whole lot.

For example,

http://github.com/zoul/Finch/

becomes:

http://github.com/zoul/Finch/zipball/master/

It then gives you a zip file to download.

Tragacanth answered 13/8, 2011 at 4:2 Comment(10)
THANK YOU! I needed to download code from a repository that didn't have a zip file, and this worked perfectly. I would have never figured out what I'm doing from the github help.Castora
Awesome info my friend. There have been many times where I have wanted to download different branches without having to install git. Honestly I don't understand why there just isn't a link for this...Impalpable
Wish this worked, but no luck here: github.com/facebook/php-webdriver --when I add "zipball/master/" to the end of that URL, I just get an error message. I'm echoing the original commenter... I just don't understand why it's so f'ing hard to download source code I see on github. I don't want a git client, I don't want to learn git, I just want to pull down the files that are right in front of my face :-)Subsist
@Subsist - it worked for me: github.com/facebook/php-webdriver/zipball/masterSmatter
Thanks-- turns out that github was working on the feature when I was trying it. I actually went back later and found the "Download" button-- and I see the URL works now too.Subsist
And the best thing about this solution is that you don't have to download from master, you can just put the name of any other branch after zipball. Changing the branch in GitHub interface doesn't change the zip download link, so you just saved me downloading git only to make a checkout. Thank you!Porshaport
Excellent tip! Just be sure that your are at the top folder of the repository when adding /zipball/master/.Willy
@PeterH Said it - you need to be at the top folder, otherwise 404 error!Puffball
If current branch is version2 the extra path must be '/zipball/version2/' otherwise it will be 404 page.Temptation
This only works if a master branch is present. If one isn't, this will 404.Partite
E
203

To clone that repository via a URL like that: yes, you do need a client, and that client is Git. That will let you make changes, your own branches, merge back in sync with other developers, maintain your own source that you can easily keep up to date without downloading the whole thing each time and writing over your own changes etc. A ZIP file won't let you do that.

It is mostly meant for people who want to develop the source rather than people who just want to get the source one off and not make changes.

But it just so happens you can get a ZIP file as well:

Click on http://github.com/zoul/Finch/ and then click on the green Clone or Download button. See here:

enter image description here

Experimental answered 1/5, 2010 at 19:15 Comment(5)
Is there any way not to have to download the entire repository? Say, if the repository is a "plugins" repo and you only want one plugin?Lundy
not without using the Github API as far as I know.Janettjanetta
No such button at that URL. In fact the content at that URL looks nothing like your screenshot. Was the zip download function removed from GitHub?Sprite
@Sprite the green button is still there, but it's now labelled "Code". Just click that green button then click "Downlad ZIP"Corporeity
Thanks. Not sure how I missed that it was under "Code"!Sprite
F
187

Updated July 2016

As of July 2016, the Download ZIP button has moved under Clone or download to extreme-right of header under the Code tab:

Download ZIP (2013)


If you don't see the button:

  • Make sure you've selected <> Code tab from right side navigation menu, or
  • Repo may not have a zip prepared. Add /archive/master.zip to the end of the repository URL and to generate a zipfile of the master branch:

http://github.com/user/repository/ -to-> http://github.com/user/repository/archive/master.zip

to get the master branch source code in a zip file. You can do the same with tags and branch names, by replacing master in the URL above with the name of the branch or tag.

Fantastic answered 3/9, 2013 at 4:13 Comment(5)
Also, if you want a tarball instead of a zip, you can change that URL to say ".tar.gz" at the end.Subsist
It looks like <>Code is selected by default, but its not. CLICK on it!Uvea
Thanks @SteveWash. That's just crazy. I also thought the Code tab was already selected. That's really poor UI (but, okay, once you learn that trick, you'll know it forever..)Packthread
If you name your tags like v1.0, the zip file ignores the v & downloads repo-1.0. Is that a bug with github?Genevivegenevra
@DebaprioB indeed it is a bug, even though it seems they went out of their way to implement that behaviour 🤔Obscurant
K
44

To download your repository as zip file via curl:

curl -L -o master.zip http://github.com/zoul/Finch/zipball/master/

If your repository is private:

curl -u 'username' -L -o master.zip http://github.com/zoul/Finch/zipball/master/

Source: Github Help

Kissable answered 14/8, 2013 at 2:39 Comment(3)
sweet! worked like a charm, I had permission limits in a batch system with no browser and this one was what I needed!Allay
With wget it's even shorter: wget https://github.com/zoul/Finch/archive/master.zipSyrup
good. but its outdated. Someone please update it.Karisa
P
26

As of December 2016, the Clone or download button is still under the <> Code tab, however it is now to the far right of the header:

Github Clone or download screenshot

Predestine answered 9/12, 2015 at 8:41 Comment(6)
Does this apply to the old layout too?Byelection
Hey, I don't see that button! github.com/Antonioya/blender/tree/master/measureitPostconsonantal
Perhaps because you are not logged in. I just checked and github has changed the layout a bit. However the button is now green and labeled "Clone or download" (for your repository the download button links to: github.com/Antonioya/blender/archive/master.zip )Predestine
I logged in and still don't see any green button - instead of "Clone or download" it says "History"Addressograph
@Addressograph Because the download is disabled for that repository. Check the note on Readme. It says, "*** NOTICE *** MeasureIt is now part of Blender official releases, so this Git repository is only for reference. If you want download last versions or report a bug, please uses Blender website."Horizon
Where is this link on mobile devices? So far I've been clicking on Desktop Version, then using this method to get a zip file.Perspicuous
D
22

Even though this is fairly an old question, I have my 2 cents to share.

You can download the repo as tar.gz as well

Like the zipball link pointed by various answers here, There is a tarball link as well which downloads the content of the git repository in tar.gz format.

curl -L http://github.com/zoul/Finch/tarball/master/

A better way

Git also provides a different URL pattern where you can simply append the type of file you want to download at the end of url. This way is better if you want to process these urls in a batch or bash script.

curl -L http://github.com/zoul/Finch/archive/master.zip

curl -L http://github.com/zoul/Finch/archive/master.tar.gz

To download a specific commit or branch

Replace master with the commit-hash or the branch-name in the above urls like below.

curl -L http://github.com/zoul/Finch/archive/cfeb671ac55f6b1aba6ed28b9bc9b246e0e.zip    
curl -L http://github.com/zoul/Finch/archive/cfeb671ac55f6b1aba6ed28b9bc9b246e0e.tar.gz --output cfeb671ac55f6b1aba6ed28b9bc9b246e0e.tar.gz

curl -L http://github.com/zoul/Finch/archive/your-branch-name.zip
curl -L http://github.com/zoul/Finch/archive/your-branch-name.tar.gz --output your-branch-name.tar.gz
Durst answered 17/12, 2017 at 17:38 Comment(1)
This is exactly what I was looking for - a URL where I can get a tarball of the current master branch using command line. However, you'll want to add -o <file> to your commands or else you'll just get the binary printed to stdout. So, in this example: curl -L https://github.com/zoul/Finch/archive/master.tar.gz -o Finch-master.tar.gz (or whatever you'd like the filename to be). I also added https: for good measure.Apsis
L
13

Here's a good reference if you want to do it from the command line: http://linuxprograms.wordpress.com/2010/10/26/checkout-code-from-github/

Basically it's

git clone http://github.com/zoul/Finch.git
Lonnylonslesaunier answered 20/9, 2013 at 4:51 Comment(1)
this doesn't download as zipAudi
I
7

I've been stumped by this too. The "Download" button is to the far right, but you also need to be in the top folder in order to download what you're seeing. Go up as high as you can to the parent/root folder and then look for the download button.

Isaacs answered 16/10, 2016 at 5:47 Comment(0)
A
3

For people using Windows and struggling to download repo as zip from terminal:

url -L http://github.com/GorvGoyl/Notion-Boost-browser-extension/archive/master.zip --output master.zip

Audi answered 9/10, 2020 at 11:28 Comment(0)
S
1

Sometimes if the 'Download ZIP' button is not available, you can click on 'Raw' and the file should download to your system.

Selfgovernment answered 18/3, 2016 at 2:37 Comment(1)
Or, as is mentioned elsewhere on this page, even if the "Code" tab looks selected... it might not be. Click on "Code" again, and see if the "Clone or download" button appears.Packthread
M
1

As of June 2016, the Download ZIP button is still under the <> Code tab, however it is now inside a button with two options clone or download:

Symfony image example

Matherne answered 8/6, 2016 at 22:46 Comment(0)
D
1

In chrome, if you hover your cursor on Download ZIP it will give you the link at the bottom of the browser

enter image description here

Damales answered 27/4, 2020 at 12:49 Comment(0)
L
0

I was facing same problem but accidentlty I sorted this problem. 1) Login in github 2) Click on Fork Button at Top Right. 3) After above step you can see Clone or download in Green color under <> Code Tab.

Luciano answered 21/11, 2016 at 8:8 Comment(0)
P
0

You can also publish a version release on Github, and there's an option to download the source code of that release in a zip file.

You can then share the zip file link to anyone to download the project source code.

Pellitory answered 27/6, 2019 at 2:58 Comment(0)
R
0

Recently, I found the following tool on GitHub: github-zipball-downloader from repository marencozy/github-zipball-downloader. It can backup all your public repositories as zip archives.

python3 github-zipball-downloader.py -username User1

It will save User1 repositories to local folder with datetime in name.

Rhinelandpalatinate answered 27/8, 2022 at 8:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.