0

I am fairly beginner in git. My repo has simple MATLAB code files. I made the mistake of uploading a large file into the repo (> 100 MB). After that, I used the following commands

git add --all
git commit --all --message "Moar"
git push --all 

The push command threw up the following error :

remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com. remote: error: Trace: 47cf7a12aa48e59e3007901d70e3843b remote: error: See http://git.io/iEPt8g for more information. remote: error: File prepro/workbench-windows64-v1.3.2/workbench/bin_windows64/rfMRI_REST1_LR_Atlas.dtseries.nii is 418.46 MB; this exceeds GitHub's file size limit of 100.00 MB ... ! [remote rejected] master -> master (pre-receive hook declined)

I then panicked and deleted the above large file that was causing the error. But now I still get the same errors when I try to push to my master!!

These large files do not exist in my local repo anymore. So why isn't git letting me push ? Also, I have some changes in the local repo after this happened so I cannot revert back to the most recent commit without these large files.

Is there a way to cleanly and precisely do it by letting git know that the large files do not exist in the repo anymore?

craigcaulfield
  • 3,381
  • 10
  • 32
  • 40
  • The large files *are still in your repository*. Your repository contains the commits; and each commit contains every file that was committed. You added a later commit that *doesn't* have the file, but the earlier one still does. See https://stackoverflow.com/questions/2100907/how-to-remove-delete-a-large-file-from-commit-history-in-git-repository – torek Oct 08 '19 at 23:40

1 Answers1

1

Since you are a beginner, read this answer it will supply a lot of information to you. How to move HEAD back to a previous location? (Detached head) & Undo commits


In order to remove content from old commit, im recommending this tool:

https://rtyley.github.io/bfg-repo-cleaner/

It the perfect tool for this kind of task

BFG Repo-Cleaner

an alternative to git-filter-branch.

The BFG is a simpler, faster alternative to git-filter-branch for cleansing bad data out of your Git repository history:

  • Removing Crazy Big Files
  • Removing Passwords, Credentials & other Private data

Examples (from the official site)

In all these examples bfg is an alias for java -jar bfg.jar.

# Delete all files named 'id_rsa' or 'id_dsa' :
bfg --delete-files id_{dsa,rsa}  my-repo.git
CodeWizard
  • 128,036
  • 21
  • 144
  • 167