简体   繁体   中英

Clone the latest version of a git repository through https

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 SO 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 ?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM