Download Git repo without all the .git stuff?

Viewed 14236

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.

4 Answers

Nowadays* github even supports direct tar.gz download.

Therefore the following works nicely

curl -L http://github.com/[username]/[repo]/archive/[branch].tar.gz | tar zxf -

Note, the -L option in curl is important since that URL has a lot of 302 Redirect HTTP replies before giving out the content. wget automatically follows them, whereas curl does not.

[*] 7 years later ;-)

Related