Download LFS file content (not pointer) with API

Added comment on an older topic so feel free to close this one if that is still alive.

It doesn’t appear that there is a way to download the file contents of an LFS tracked file using the repository files api. Repository files API | GitLab

What this ends up returning is the content of the pointer file, for both the content field of the get_file endpoint Repository files API | GitLab and also the content of the get_raw_file endpoint Repository files API | GitLab.

How can one programmatically, through an HTTP(S) call retrieve the contents of an LFS tracked file?

I am not familiar with LFS. Can you do what you want to do using the GitLab web app? If so, you may be able to use an internal API normally used by the web app, authenticated by personal access tokens.

Funny you mentioned this. I just came back to update this topic.

Noted that the web app supported downloading the files as one would expect. So just used the download url for the application and passed in the same API token header that the API requires and it worked as expected.

Yep, indeed. I’ve found the same for the Docker registry, which doesn’t seem to have endpoints in the formal API. I’ve asked a question to see if anyone knows how stable the “hidden” API is :wink: