Nerd For Tech
Published in

Nerd For Tech

How to Setup Git-LFS

Objective: Using Git-LFS to push files with size more than 100MB

You may see error something like this when trying to upload files of more than 100MB to your repository without git-LFS

So what we do is download the git LFS installation file. you can find it on top in google search.

After the download is complete, install it in your PC and we are ready apply it inside git bash.

Then initialize the installed git lfs with git lfs install command. You will only need to do this once when you setup the lfs so after complete process, there is no need to do this again in the same repository.

Now you need to track the file that has the size of more than 100MB so write the line git lfs track “*.filetype”. This command now tracks all the file of type .psd.

Now add the .gitattributes file to be pushed. This file contains the information regarding the tracking of files from above tracking filetype.

Then write the command git lfs migrate. We do this because we have already commited our files for push and by default, it will not change to lfs during push so we enter this command to find the options for potential use cases.

With this command, you can convert the files types to lfs without modifying the existing history of your repository.

And the file has been successfully pushed.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store