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.)

0

8 Answers 8

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.

7
  • 27
    I often miss this button myself. They should make it a bit more 'visible'.
    – ZeissS
    Jun 24, 2011 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, 2011 at 12:13
  • 7
    If -like me- you couldn't find it: CTRL+F then write ZIP May 23, 2013 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, 2014 at 2:31
  • 1
    I couldn't find any download button for a branch of a project Apr 20, 2015 at 19:04
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.

5
  • 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? Apr 2, 2013 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.) Aug 13, 2014 at 0: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, 2014 at 4: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, 2015 at 20:31
  • Actually, "git pull" is faster than "git clone"
    – Makan
    Oct 6, 2017 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.

3
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.

1
  • 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.
    – RolfBly
    Dec 8, 2016 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

1
  • sometimes when clicking download button doesn't download the repo , but this does helped me Mar 12, 2019 at 19:09
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
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?).

1
  • 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. Mar 15, 2015 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

Not the answer you're looking for? Browse other questions tagged or ask your own question.