Kevin_TA
Kevin_TA

Reputation: 4685

Git still trying to push ignored and deleted file

I have a .framework file that is rather large and for some reason Git LFS is not working correctly for it, so I decided to ignore it so that it is not pushed.

  1. I added it to my .gitignore.
  2. I ran these 3 commands from Terminal

    git rm -r --cached .
    git add .
    git commit -m "fixed untracked files"
    
  3. I confirmed that the .framework is no longer being tracked.

  4. When I try to push the commit again, I still get the error that the file is too large.

    remote: error: GH001: Large files detected. You may want to try Git Large 
    File Storage - https://git-lfs.github.com.
    remote: error: Trace: 6b97634aa8b5de75e8affdcb19d13b98
    remote: error: See http://git.io/iEPt8g for more information.
    remote: error: File path/to/My.framework/Versions/A/My is 101.13 MB;
    this exceeds GitHub's file size limit of 100.00 MB
    
  5. I also deleted the file entirely and it is still attempting to push it.

The .framework wasn't always so big. It only recently became >100MB so it used to push without a problem. Is there any solution here?

Upvotes: 3

Views: 4562

Answers (1)

Schwern
Schwern

Reputation: 165536

When you push, you're not just pushing one commit, you're pushing all commits which the remote does not yet have. I think you did something like this.

1. Push/pull to be in sync with the remote.
2. Commit the large file.
3. Delete the large file.
4. Push.

Now you're pushing both the commit which added the large file and the commit which deleted it. They both have to be pushed.

You can check what's going to be pushed with git log --stat origin/master (assuming the remote is origin and the branch is master). In particular, commit 6b97634aa8b5de75e8affdcb19d13b98 will be the problem.

If this is the case, you will have to delete the large file from history.

But given that you're having trouble with both git-lfs and pushing, I think there's something else going on here. I suspect there's another large file you're missing. Perhaps you could show your actual repository?

Upvotes: 1

Related Questions