[Common Issue] Are there extra steps required when moving from another Git LFS provider to Netlify Large Media?

answered
#1

Actually, yes! If you were using Git LFS with another service (such as GitHub, GitLab, and/or Bitbucket) there are additional steps required when enabling Netlify Large Media.

First, if you’re already using Git LFS you may not have all of your assets stored locally. This will mean that only pointers are uploaded to Netlify Large Media unless we take this into account by making a complete clone of the repo.

Make a complete clone of the repo

So, how does one make sure they have the full files to upload them to Netlify Large Media?

Well, the following command makes a “complete” clone of the repo which will include the actual files already using Git LFS (instead of just their pointers).

git lfs fetch origin --all

Note, this may take a long time to complete as it will be downloading every version of these files locally (and this may be a large amount of data).

Disable the previous LFS service

In many cases (this is known to be true for GitLab for example), the existing Git LFS service must be disabled.

So if, for example, your repository is stored on GitLab, you will need to disable GitLab’s Large File Service (LFS) in the project permissions settings.

Install and configure Netlify Large Media

Now, install Netlify Large Media. There are already instructions for this (so I won’t reinvent the wheel) found via the link below:

Enabling Netlify Large Media

Push the files to Netlify Large Media

Now that the full files are available locally, they can be uploaded to Netlify Large Media using the following command:

git lfs push --all

Disable the environment variable

The last step is disabling the environment variable (or variables) normally used when Git LFS is in use but the provider is not Netlify Large Media. This is the GIT_LFS_ENABLED variable and it should simply be deleted.

This setting can be found under Site Name > Settings > Build & deploy > Environment or using a URL like the one below (replacing <subdomain> with the Netlify subdomain for your site):

https://app.netlify.com/sites/<subdomain>/settings/deploys#environment

The end!

This will complete the process of moving your files from the previous Git LFS provider to Netlify Large Media.

If there are other questions about this, please reply and let us know in the comments below.