git lfs – How to commit and push a large file using git lfs

Last modified date

Comments: 0



Assuming you have git lfs installed, how do you go about pushing the file to git.

Performing a standard git push doesn’t work, git will throw an error saying the file is too large to commit.


Firstly unstage the commit with the large file and then delete the file from your local environment.

Next you need to tell git lfs to track the large file using this command:

git lfs track "my-large-file.json"

This will also create a .gitattributes file in the root of the project.

Then add the large file back into your project.

Next add all the files you want to commit:

git add .

This will add the large file and the git attributes file that was created.

Commit the changes:

git commit -m "added large file commit"

Then perform a standard git push:

git push

It will successfully push the large file to your remote git repo.


Leave a Reply

Your email address will not be published. Required fields are marked *

Post comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.