Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Download Git repo without all the .git stuff?

Tags:

git

github

Is there a way to download the contents of a git repo from the Unix command line that doesn't pull down everything in the .git directory? I just want the latest version of the repo directories and files, not all the diffs.

Also, is it possible to accomplish this without using a git command (perhaps with wget or curl, for example)?

Thanks.

like image 647
Jim Avatar asked Dec 17 '13 21:12

Jim


People also ask

How do I Download only part of a GitHub repository?

GitHub User InterfaceThere's a download button on the repository's homepage. Of course, this downloads the entire repo, after which you would need to unzip the download and then manually drag out the specific folder you need.

Can I just copy the .git folder?

Thanks. Yes you can, but there's no need to copy the full working tree. You can copy just the . git folder without the working tree (i.e. as a "bare" repo) and then checkout the latest working tree on the other machine.

How do I Download entire git repository?

When downloading materials to your laptop, it is easiest to download the entire repository. To do this, go to the GitHub page for the workshop, click on the green Code button, then download the repository as a ZIP file. The filename may be different than what's in the picture. Find the downloaded .


3 Answers

github has a link to download a .zip archive of the repo, so try using

wget https://github.com/[user]/[repo]/archive/[branch].zip

with [user], [repo], and [branch] replaced with the appropriate fields.

like image 58
randomusername Avatar answered Oct 23 '22 01:10

randomusername


As far as I know, the closest thing you can do is to do a git clone --depth=1 (to avoid retrieving more information from the server than you need for the latest version) and then delete the .git directory afterwards. As far as git is concerned, the .git directory is the repo; the checked-out files are just there for your convenience. :)

like image 29
hobbs Avatar answered Oct 23 '22 00:10

hobbs


2nd part : You can try the username and repo name substituted correctly

wget http://github.com/[username]/[repo]/archive/master.zip
like image 21
sujithvm Avatar answered Oct 23 '22 01:10

sujithvm