How to use Git-lfs ( Large File Storage ) to push large files to Github

Pavan Skipo
Junior Dev
Published in
Jul 6, 2020
Made this on imgflip, source: Spongebob Cartoon Show

So the other day I came across this error while uploading a CSV file where Github says that it won’t accept files which are greater than 100mb.

Error while pushing Large files to Git

this made me realise that we’ve been taking Github for granted and that we should use it more wisely…. lol, joke…Here’s how to load up that repo:

  • Step 1: Download and Install Git-lfs ( Git Large File Storage ) from here.
  • Step 2: Setup Git lfs for your user account git lfs install.
  • Step 3: If you have already tried to commit large files and got the error then you must first undo the commit, use git reset — soft HEAD~1 otherwise ignore this step.
  • Step 4: Select the file types that you want Git-lfs to manage using the command git lfs track “*.csv” , this creates a .gitattributes file.
  • Step 5: Add the .gitattributes file along with other files which need to be committed and push the changes.
git add .gitattributes TrainAndValid.csv
git commit -m "Adding Train and Validation set"
git push origin master

And it pushed without any errors :)

Large files have been pushed to Git

--

--

Pavan Skipo
Junior Dev

Software Engineer by Day | Game Developer by Night. If you want to know more about me visit: https://pavanskipo.com/