DEV Community

Tek Kshetri
Tek Kshetri

Posted on • Edited on

Upload large file to GitHub

To upload large file to GitHub, follow the following steps,

1. Install and select LFS file

git lfs install

# I am adding the deep learning model file
git lfs track "*.h5"
Enter fullscreen mode Exit fullscreen mode

2. Commit and push to the GitHub

git lfs push --all origin main

git add .
git commit -am "add large file"
git push -u origin main
Enter fullscreen mode Exit fullscreen mode

Solve large file upload issue

If you already tried to upload the file and facing remote: error: File model.h5 is 270.75 MB; this exceeds GitHub's file size limit of 100.00 MB similar issue, It can be solved by following method,

1. Reset git

git reset HEAD~<HOWEVER MANY COMMITS YOU WERE BEHIND>
Enter fullscreen mode Exit fullscreen mode

If you want to go before one commit: git reset HEAD~1

Pro Tip: Check git log: git log

2. Check status and push

git status

git push
Enter fullscreen mode Exit fullscreen mode

Top comments (2)

Collapse
 
yuukinaesa profile image
Yuukinaesa

Thankyoouuuuu so much

Collapse
 
remonsec profile image
Mehedi Hasan Remon

Thank you