223

I need to download the source code of the project Spring data graph example into my box. It has public read-only access. Is there is an extremely fast way of downloading this code?

I have no idea of working on GitHub/committing code and most tutorials out there on the web seems to assume that "I would want to setup a project in GitHub" and inundate me with 15-20 step processes. To me, if a source repository is available for the public, it should take less than 10 seconds to have that code in my filesystem.

Tutorials that provide me with 15-20 step processes:

I need something very very very simple. Just pull the source code, and I am more interested in seeing the source code and not learn GitHub.

Are there any fast pointers/tutorials? (I have a GitHub account.)

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Kannan Ekanath
  • 16,759
  • 22
  • 75
  • 101

8 Answers8

267

When you are on a project page, you can press the Download ZIP button which is located under the green <> Code drop down:

Screenshot showing "Download ZIP" button

This allows you to download the most recent version of the code as a zip archive.

If you aren't seeing that button, it is likely because you aren't on the main project page. To get there, click on the left-most tab labeled <> Code.

jncraton
  • 9,022
  • 3
  • 34
  • 49
  • 27
    I often miss this button myself. They should make it a bit more 'visible'. – ZeissS Jun 24 '11 at 11:19
  • 24
    Well, in terms of its non-obvious placement... When you click that button, you're saying to github, "You know that whole source code management infrastructure that you're wrapped around? The whole multi-user file sharing and versioning universe that you are? Well screw all that, just give me the goodies." I mean, use that button, it's no problem, that's what it's there for, but it's for sure not the predominant use case of the site. – Dan Ray Jun 24 '11 at 12:13
  • 7
    If -like me- you couldn't find it: CTRL+F then write ZIP – Nabil Kadimi May 23 '13 at 17:17
  • 36
    It's also important to note that you must be on the MAIN PROJECT PAGE, and not a page for a directory or file in the project (even if that file is a stand-alone program). The subpages don't have download information on them -- whether you are using a browser or git. – adam.r May 21 '14 at 02:31
  • 1
    I couldn't find any download button for a branch of a project – javier_domenech Apr 20 '15 at 19:04
  • +1 to admin.r's comment. If you are lost and need to get back to the main project page then clicking the <>Code menu item will take you back there. Then the "Clone or Download" button will be available as per jncraton's answer – Stewart Evans Feb 03 '17 at 02:40
  • Is there a way to download the whole repo INCLUDING files the are marked as `export-ignore` in gitattributes (e.g. like `docs`-folder in this repo https://github.com/yiisoft/yii2-app-advanced) ? – Radon8472 Jul 06 '22 at 07:13
91

You say:

To me if a source repository is available for public it should take less than 10 seconds to have that code in my filesystem.

And of course, if you want to use Git (which GitHub is all about), then what you do to get the code onto your system is called "cloning the repository".

It's a single Git invocation on the command line, and it will give you the code just as seen when you browse the repository on the web (when getting a ZIP archive, you will need to unpack it and so on, it's not always directly browsable). For the repository you mention, you would do:

$ git clone git://github.com/SpringSource/spring-data-graph-examples.git

The git:-type URL is the one from the page you linked to. On my system just now, running the above command took 3.2 seconds. Of course, unlike ZIP, the time to clone a repository will increase when the repository's history grows. There are options for that, but let's keep this simple.

I'm just saying: You sound very frustrated when a large part of the problem is your reluctance to actually use Git.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
unwind
  • 391,730
  • 64
  • 469
  • 606
  • 24
    I think a lot of people get me wrong here. That may be because they are so passionate about the tools they use and "I get it". If you observe the question closely the point was to "look at Spring DataGraph example" which was my most obvious need. For the given valid question "Download as ZIP" is a perfectly valid and acceptable solution. This by no means implies git is an inferior quality source control system (I love git). Infact this does not even mean I am reluctant to use Git. Imagine every single thing you tried to do mandated that you learn 15 other tools? – Kannan Ekanath Apr 02 '13 at 10:36
  • 1
    @CalmStorm I think this reaction was because from the start you seemed pissed about `git`. But to be fair, the transition between "wow, `git` sucks balls" to "wow, `git` is great" may take between weeks and months if you were already comfortable with e.g., subversion or any other tool that doesn't assume you're a Midnight-commander junkie that has all the free time in the world to read a dozen man pages written by people who love to make up new words for everything. (I mean, if you read the man pages for `git`, they make every single concept look waaaaay more difficult and complex than it is.) – Camilo Martin Aug 13 '14 at 00:26
  • 8
    this is the answer that I was looking for, "how to get the code using git". Why is this simple command not included next to the "download" link as well? Would be so useful for us non-git users. Thanks again. +1 – insaner Nov 30 '14 at 04:42
  • 4
    @unwind "I'm just saying: You sound very frustrated when a large part of the problem is due to Git and Github's poorly created and non-intuitive interface, which is perfectly understandable since it was not built with the novice user in mind." TFTFY – Padawan Jul 25 '15 at 20:31
  • Actually, "git pull" is faster than "git clone" – Makan Oct 06 '17 at 14:47
45

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.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Manav Kataria
  • 5,060
  • 4
  • 24
  • 26
  • 1
    I don't see download zip for this. How to download this link? https://github.com/maryo/php-5.5-windows-extensions/tree/master/php_gmagick-1.1.6RC2-5.5-vc11-x86 – Airy Jan 08 '14 at 14:25
  • 5
    You can only download repositories. That path is not a repository but a directory within a repository. You need to download each individual files. Use the 'Raw' button once you click each file. – Manav Kataria Jan 08 '14 at 20:28
  • Is there a way to download the whole repo INCLUDING files the are marked as `export-ignore` in gitattributes (e.g. like `docs`-folder in this repo https://github.com/yiisoft/yii2-app-advanced) ? – Radon8472 Jul 06 '22 at 07:14
18

Another faster way of downloading a GitHub project would be to use the clone functionality with the --depth argument as:

git clone --depth=1 git@github.com:organization/your-repo.git

to perform a shallow clone.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
purezen
  • 612
  • 12
  • 29
  • 1
    For those who, like me, didn't know: `git clone your-git-url` will give you the project _including all revisions_. So `--depth=1` gets you only the latest revision, hence 'shallow' clone. Nice! [source](https://www.perforce.com/blog/141218/git-beyond-basics-using-shallow-clones). – RolfBly Dec 08 '16 at 21:09
14

Downloading with Git using Windows CMD from a GitHub project

You can get download the link from GitHub <b>HTTPS clone URL</b>

Download with Window Command Prompt cmd for above picture HTTPS clone URL

  1. Copy the HTTPS clone URL shown in picture 1

  2. Open CMD

  3. git clone //paste the URL show in picture 2

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ye Htun Z
  • 2,079
  • 4
  • 20
  • 31
9

Use

git clone https://github.com/<path>/repository
or
git clone https://github.com/<path>/<master>.git

examples

git clone https://github.com/spring-projects/spring-data-graph-examples
git clone https://github.com/spring-projects/spring-data-graph-examples.git
Jonathan L
  • 9,552
  • 4
  • 49
  • 38
4

There is a new (sometime pre April 2013) option on the site that says "Clone in Windows".

This works very nicely if you already have the Windows GitHub Client as mentioned by @Tommy in his answer on this related question (How to download source in ZIP format from GitHub?).

Community
  • 1
  • 1
Richard Le Mesurier
  • 29,432
  • 22
  • 140
  • 255
  • I think this is now called "Clone in Desktop". This sounded quite useful so I installed the client on Win 7 but Chrome seems not to be able to find it. Whenever I click "Clone in Desktop" it just asks me to download the client again. – Glenn Lawrence Mar 15 '15 at 22:56
1

I agree with the current answers, I just wanna add little more information, Here's a good functionality

if you want to require just zip file but the owner has not prepared a zip file,

To simply download a repository as a zip file: add the extra path /zipball/master/ to the end of the repository URL, This will give you a full ZIP file

For example, here is your repository

https://github.com/spring-projects/spring-data-graph-examples

Add zipball/master/ in your repository link

https://github.com/spring-projects/spring-data-graph-examples/zipball/master/

Paste the URL into your browser and it will give you a zip file to download

Udhav Sarvaiya
  • 9,380
  • 13
  • 53
  • 64