Clone the latest version of a git repository through https

233 views Asked by At

I would like to get some files from a project : I do not need to clone the entire repository : I need only the latest snapshot from the master branch. This is important for me because, my bandwidth is quite low, it takes some time to download everything.

On another S.O. question, I saw that one can use 'git archive' to do so, unfortunately, it seems it does not work with https:

git archive --format=tar --remote=https://github.com/thomaspark/bootswatch.git master | tar tvf -

returns "fatal: Operation not supported by protocol."

This command is working with ssh:// but not with https://

for github, I could download the provided zip file on the web interface, but for other repositories that do not provide it, how can I get a simple snapshot from a git repository https URL ?

1

There are 1 answers

0
Chris Maes On BEST ANSWER

you could just take a "shallow clone":

git clone --depth 1 <repository>

this will take only the last n (=1 in this case) commits from the history; thus requiring less bandwidth. You can read more in the git documentation

This will be a fully functional git repository; you will be able to push, pull, commit etc. You will only have a part of the the history yourself, so this should fulfill your needs.