Tdd Apps

# Migrating large files to GitHub

Jan 8, 2019 2 minute read

GitHub does not track files larger than 100MB. I hit this limit during a recent repository migration. git lsf and bfg helped me push everything. These are the steps I took to overcome this limitation.



Step 1: Try to push.

git push origin master

GH001 Error

Pushing to
POST git-receive-pack (chunked)
remote: error: GH001: Large files detected. You may want to try Git Large File Storage -        
remote: error: Trace: 354c0f098fda496abeb40f7f6472b655        
remote: error: See for more information.        
remote: error: File Assets/Dependencies/libsmbclient.a is 114.65 MB; this exceeds GitHub's file size limit of 100.00 MB        
 ! [remote rejected] change-photo-source-buttons -> change-photo-source-buttons (pre-receive hook declined)
 ! [remote rejected] critical-section -> critical-section (pre-receive hook declined)
 ! [remote rejected] master -> master (pre-receive hook declined)
 ! [remote rejected] version_1_0 -> version_1_0 (pre-receive hook declined)
 ! [remote rejected] version_1_1 -> version_1_1 (pre-receive hook declined)
error: failed to push some refs to ''
Completed with errors, see above

Write down the problematic filename. libsmbclient.a in this case.

Step 2: Remove the file from your history. Don’t worry, it will stay in your working directory.

java -jar ~/Downloads/bfg-1.13.0.jar --delete-files libsmbclient.a --no-blob-protection

Step 3: Unstage the file.

git reset

Step 4: Track the file as a Large Object.

git lfs track "libsmbclient.a"

Step 5: Stage, commit and push.

git add -A && \
  git commit -m "track large objects properly" && \
  git push origin master


Pushing to
POST git-receive-pack (786 bytes)
 = [up to date]      version_1_0 -> version_1_0
 = [up to date]      version_1_1 -> version_1_1
   8ce3374..e7fb4b8  master -> master
updating local tracking ref 'refs/remotes/github/master'
Uploading LFS objects: 100% (1/1), 120 MB | 1.4 MB/s, done
Completed successfully

Got other errors?

Repeat the steps if the error persists with other files.

Want to know more?

Never miss a post. Subscribe to our newsletter