Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Download Git LFS files without checkout

Tags:

git

git-lfs

I'm looking for a way to download some git LFS zip files I have in a repo without having to checkout the entire repository.

I have tried the following:

curl -L <URL to the file RAW download on github page>

  • This downloads a html file and not the actual file.

curl -L <URL from .lfsconfig file + object ID from the file's pointer information in git repo>

  • Gives a "Not found" error

More example tries:

curl  -L https://gitlfs.es.com/api/company/myrepository/content/framework/7d5dfcf764118df4867dc676b615e1ee4bf67e5b37fd56275f8845d
 
curl  -L https://gitlfs.es.com/api/company/myrepository/7d5dfcf764118df4d188d5838867dc676b615e1ee4bf67e5b37fd56275f8
 
curl  -L https://gitlfs.es.com/api/company/myrepository/sha256:7d5dfcf764118df4d188d5838867dc676b615e1ee4bf67e5b37fd56275f8845d

None of the above seems to work

Any leads will be appreciated.

like image 824
A.R.K.S Avatar asked Apr 29 '19 04:04

A.R.K.S


People also ask

Where does Git store LFS locally?

Git LFS stores the binary file content on a custom server or via GitHub, GitLab, or BitBucket's built-in LFS storage. To find the binary content's location, look in your repository's . git/lfs/objects folder.

How do I clone a Git repository LFS?

Once Git LFS is installed, you can clone a Git LFS repository as normal using git clone . At the end of the cloning process Git will check out the default branch (usually main ), and any Git LFS files needed to complete the checkout process will be automatically downloaded for you.


1 Answers

If the repository is private then you need to pass either Gitlab authorization token or account authentication credentials in curl command.

You may find links below useful:

https://docs.gitlab.com/ce/api/repository_files.html#get-file-from-repository https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html

like image 97
initanmol Avatar answered Sep 23 '22 16:09

initanmol