{"id":15598038,"url":"https://github.com/ibob/git-lfs-download","last_synced_at":"2025-09-20T08:33:34.548Z","repository":{"id":182312045,"uuid":"668183810","full_name":"iboB/git-lfs-download","owner":"iboB","description":"Download full or partial git-lfs repos without temporarily using 2x disk space","archived":false,"fork":false,"pushed_at":"2023-10-13T03:13:38.000Z","size":18,"stargazers_count":30,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-01T01:50:23.132Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iboB.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-07-19T08:09:57.000Z","updated_at":"2024-08-09T17:27:34.000Z","dependencies_parsed_at":"2023-07-19T14:29:17.388Z","dependency_job_id":null,"html_url":"https://github.com/iboB/git-lfs-download","commit_stats":null,"previous_names":["ibob/git-lfs-download"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboB%2Fgit-lfs-download","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboB%2Fgit-lfs-download/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboB%2Fgit-lfs-download/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboB%2Fgit-lfs-download/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iboB","download_url":"https://codeload.github.com/iboB/git-lfs-download/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233648599,"owners_count":18708225,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T01:26:39.307Z","updated_at":"2025-09-20T08:33:29.286Z","avatar_url":"https://github.com/iboB.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# git-lfs-download\n\nA CLI tool which downloads a git-lfs repo fully or partially without temporarily using 2x disk space and without using any disk space for lfs files which are not downloaded.\n\n**Usage:**\n\n*A Ruby interpreter is needed for the tool. Ruby 3.0.0 or later is required*\n\n`$ ./git-lfs-download \u003crepo-uri\u003e [--match \u003cpattern\u003e] [--without \u003cpattern\u003e]`\n\nBy default the full repository is downloaded. Adding `--match` patterns will only include files which match any of them. Adding `--without` patterns will exclude files which match any of them.\n\n## Task\n\nYou want to download a git-lfs repo\n\n## Problem\n\nUsing `$ git clone` will download the repo, but after the download it will copy all files from the `.git` directory to the clone directory. This uses at least double the disk space of the repo.\n\nYou may not have 2x disk space. It could be hundreds of gigabytes: game assets, weights for huge neural networks...\n\nTime is wasted in copying these huge files. Note that this will likely be negligible compared to the download time, but still, unpleasant.\n\n## Proper solution\n\nUse [git-archive](https://git-scm.com/docs/git-archive) and pipe its output to an extracting program.\n\n`$ git archive --format=tar --remote=\u003crepo url\u003e HEAD | tar xf -`\n\nThis will also solve the sane problem if you encounter it with non git-lfs files.\n\nUnfortunately git-archive can exert quite the cpu toll on the server and most git providers (like GitHub and Huggingface) have it disabled server-side rendering it unusable.\n\n## Task 2\n\nYou want to download only some large files from a git lfs repo\n\n## Proper solution\n\nManually `$ git lfs pull --include \u003cfile\u003e`. This is pretty cumbersome especially if there are many files, or files to filter-*out*.\n\nDisk space x2 will be required.\n\n## Hack which this project implements\n\n* Clone a shallow repo skipping lfs smudge\n* Parse `.gitattributes` to identify lfs files\n* Filter lfs files according to provided options (if any)\n* Fetch lfs files\n* `mv` the files from `.git/lfs/objects` to their places in the git root\n* `$ rm -rf .git`\n\n## Copyright\n\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\nThis software is distributed under the MIT Software License.\n\nSee accompanying file LICENSE or copy [here](https://opensource.org/licenses/MIT).\n\nCopyright \u0026copy; 2023 [Borislav Stanimirov](http://github.com/iboB)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibob%2Fgit-lfs-download","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fibob%2Fgit-lfs-download","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibob%2Fgit-lfs-download/lists"}