3

I tried to push my project to github, and received the following error:

Counting objects: 87, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (78/78), done.
Writing objects: 100% (87/87), 50.25 MiB | 1.14 MiB/s, done.
Total 87 (delta 32), reused 0 (delta 0)
remote: warning: File example-attractor/bin/example-attractor_debug.ilk is 51.19 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: f711bd940689c3c64a38c283877b86f8
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File example-attractor/example-attractor.sdf is 103.62 MB; this exceeds GitHub's file size limit of 100.00 MB
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs

Okay, no big deal. I added *.sdf and *.ilk to my .gitignore, removed and added all of my files, and checked my tracked files via git ls-files:

.gitignore
example-attractor/README.md
example-attractor/addons.make
example-attractor/example-attractor.sln
example-attractor/example-attractor.vcxproj
example-attractor/example-attractor.vcxproj.filters
example-attractor/icon.rc
example-attractor/src/main.cpp
example-attractor/src/ofApp.cpp
example-attractor/src/ofApp.h

Great! The files have been removed from tracking. I tried pushing to github again and... got the same error. I ran git status and there's no changes:

On branch master
Your branch is ahead of 'origin/master' by 3 commits.
  (use "git push" to publish your local commits)
nothing to commit, working directory clean

I'm perplexed as to what to do now! Why is git still trying to push files that aren't tracked?

nathan lachenmyer
  • 5,298
  • 8
  • 36
  • 57
  • Possible duplicate of [How to remove a too large file in a commit when my branch is ahead of master by 5 commits](http://stackoverflow.com/questions/20002557/how-to-remove-a-too-large-file-in-a-commit-when-my-branch-is-ahead-of-master-by) – Powerlord Feb 05 '16 at 22:25
  • Unfortunately not; none of the solutions there solved my problem :( – nathan lachenmyer Feb 05 '16 at 22:30

2 Answers2

3

The most likely explanation is that you committed the file in one of those previous 3 commits. What you will need to do is remove it from them. Do this by doing git rebase -i origin/master. This will bring up an editor with all of those commits. Replace "pick" with "e" for all three commits, save and close the editor. Git will now pause after each commit, at which point you can delete the file from the index, do git commit --amend, then git rebase --continue. Then you should be fine.

David Deutsch
  • 17,443
  • 4
  • 47
  • 54
1

Great! The files have been removed from tracking.

From future tracking, yes. But you still have the commit(s) in your local history of branch master.

Why is git still trying to push files that aren't tracked?

When you push a branch, all its ancestor commits that aren't yet on the remote are pushed there, too.

I'm perplexed as to what to do now!

Remove the unwanted files from the branch's history, either like David suggests with git rebase -i origin/master while on the master branch, or with git filter-branch. In either case, make a backup of your repository before altering any history.

Community
  • 1
  • 1
das-g
  • 9,718
  • 4
  • 38
  • 80