Git LFS(Large File Storage)_How to commit files over 100MB to Github?
Tags: github, git, lfs, beginners
Published: 2019-09-02 02:47:06

 As we are working on a few static websites which might include portfolios, personal gallery websites etc, we have to sometimes deal with storage problems when it comes to version controlling through git, especially for videos and high quality pictures. The warning message below is what I got couple of days ago on a process of committing a file which included a video over 100MB.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/d2wf2iy091qqpaeg2iab.png)

So basically, what it says is to avoid committing these files or <b>use Git LFS to store large files on github.<b>
hold on a minute, what is git LFS?

<h3><b>Firstly,</b> What is <b> LFS <b>?</h3>
LFS stands for Large File Storage which is an open source extension provided by git for versioning large files.
In this post, I would like to talk about basic steps that you can take to use LFS properly and easily.

<h3><b>Secondly,</b> Ok, how to use <b> LFS <b>?</h3>

<a href="https://github.com/git-lfs/git-lfs">Click here to read more documentations.</a>
<a href="https://github.com/git-lfs/git-lfs/releases/v2.8.0"> Check the latest released version</a>

First of all, Let's make sure we download the recent version of LFS according to the operating systems. 

After downloading the LFS file source loacally, then we can go to our project directory file and execute the following lines.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/480yxuhx2gt6s45916f3.png)

If you are done intalling lfs for the repository then we need to specify the type of file which will be taken and tracked by lfs. 
In this case, I am trying to upload this video file which is "mp4" format. I would like to execute the following line.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/akokwmbgf1mewcyal93q.png)

Of course, depending on your file format it could be something like these,
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/mmaavam2juovzg184zxe.png)

Alright! We are almost there, after specifying the troublesome files, then you will be able to notice some changes in the gitattribute file as well.
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/k0elx7aigfa727r6ofwm.png)
Cool, then let's go ahead and push the new changes to the github and see what happens!
If you are using github desktop, it can't be easier! You can simply click the "commit to master" button. Otherwise, you can use the lines below in your terminal as well. 
 ![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/f0dys0lav1ln7q0c66jr.png)

Congratulations! Now your file is being managed by github lfs! 

<h3><b>Lastly,</b> How do I check if a file is managed by LFS properly?</h3>

If you want to double check whether your files are being managed git lfs properly and whether you are missing out on something, you can also check the list of all the files.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/54l5ubt3vnqfl52pi7po.png)

<h3><b>Summing up</b></h3>
Today, we have covered really easy way to deal with larger files on git. It would be really useful when it comes to manage the project workflow on github because sometimes, server storage can be pain in the neck in many ways and this knowledge of lfs can be quite helpful to avoid those problems!