How To Download From Github

How To Download From Github Rating: 3,8/5 786 votes

These steps show two less common interactions with git to extract a single file which is inside a subfolder from a git repository. These steps essentially reduce the repository to just the desired files and should performed on a copy of the original repository (1.).

Extend your GitHub workflow beyond your browser with GitHub Desktop, completely redesigned with Electron. Get a unified cross-platform experience that’s completely open source and ready to customize. Download for macOS Download for Windows (64bit) Download.

First the repository is reduced to just the subfolder containing the files in question using git filter-branch --subdirectory-filter (2.) which is a useful step by itself if just a subfolder needs to be extracted. This step moves the desired files to the top level of the repository.

Finally all remaining files are listed using git ls, the files to keep are removed from that using grep -v and the resulting list is passed to git rm which is invoked by git filter-branch --index-filter (3.). A bit convoluted but it does the trick.

1. copy the repository to extract the file from and go to the desired branch

2. reduce the repository to just the subfolder »etc« which contains the interesting file(s)

3. remove all files other than the ones you want to keep (tmarc.xsl, check-pazpar2.xsl)

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
14.2k19 gold badges88 silver badges115 bronze badges
Kannan EkanathKannan Ekanath
8,04814 gold badges52 silver badges90 bronze badges

8 Answers

Github

When you are on a project page, you can press the 'Download ZIP' button which is located under the 'Clone or Download' drop down:

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

How To Download From Github On Raspberry Pi

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

jncratonjncraton
7,5952 gold badges26 silver badges46 bronze badges

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:

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
14.2k19 gold badges88 silver badges115 bronze badges
unwindunwind
329k54 gold badges407 silver badges540 bronze badges

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:

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.

-to-

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
21.3k10 gold badges122 silver badges168 bronze badges
Manav KatariaManav Kataria
3,0591 gold badge19 silver badges26 bronze badges

Downloading with Git using Windows CMD from a GitHub project

  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
14.2k19 gold badges88 silver badges115 bronze badges
YeHtunZYeHtunZ
1,7792 gold badges11 silver badges22 bronze badges

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

to perform a shallow clone.

Peter Mortensen
14.2k19 gold badges88 silver badges115 bronze badges
purezenpurezen
Jonathan LJonathan L
3,1761 gold badge28 silver badges21 bronze badges

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
Richard Le MesurierRichard Le Mesurier
20k17 gold badges110 silver badges209 bronze badges

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

How To Download From Github Repository

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

Add zipball/master/ in your repository link

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

Udhav SarvaiyaUdhav Sarvaiya

How To Download From Github Kali Linux

2,9039 gold badges21 silver badges32 bronze badges

protected by CommunityApr 16 '15 at 11:10

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?

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