1

I had one large file commit and push, but then it failed. After that I removed the large file, and ignore it in git, but since then no more push is working at all.

How to fix it?

==[IDE]== Jan 17, 2017 1:25:30 AM Pushing - sip-phone
git branch
git remote -v
setting up remote: origin
git submodule status
git push git@github.com:xxxxx/sip-phone.git refs/heads/master:refs/heads/master
Resolving deltas: 100% (22/22), completed with 3 local objects.
error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
error: Trace: xxfxxxxxx73bfbfecaba
error: See http://git.io/iEPt8g for more information.
error: File tls/tb/plugin/Safari.pkg is 126.54 MB; this exceeds GitHub's file size limit of 100.00 MB

Remote Repository Updates
Branch Update : master
Old Id        : b739976f2dfc95d6c79810a66e3ec87e5ad5e12b
New Id        : e06457ec3487834e8129ac511d7f7036f2f34b5b
Result        : REJECTED_OTHER_REASON

Local Repository Updates
==[IDE]== Jan 17, 2017 1:26:51 AM Pushing - sip-phone finished.

Thanks in advance.

UpAndAdam
  • 4,515
  • 3
  • 28
  • 46

2 Answers2

2

There are few steps need to remove info about the large file completely:

1. Check when did the large file appear in commit histories,

git log --oneline --branches -- largefilename

And then copy the earliest commit id (appear in the bottom).

2. Delete the file from the earliest related commit histories,

git filter-branch --index-filter  'git rm --ignore-unmatch --cached largefilename' -- <earliest_commit_id>^..

3. Clean the stuff in .git as below:

rm -Rf .git/refs/original rm -Rf .git/logs/ git gc git prune --expire now

4. Now you can push to remote successfully.

Marina Liu
  • 36,876
  • 5
  • 61
  • 74
0

You removed it, but only in a new commit, it is still there in the older commit and GitHub will not allow you to push it. You need to remove the file from history completely, not only delete it with a new commit. If this is only introduced in one of your recent commits and not touched afterwards, it will probably be easiest to use git rebase -i to edit the commit in question and remove the large file from the commit. If it is longer present and changed multiple times, git filter-branch with an --index-filter would be the right choice.

Vampire
  • 35,631
  • 4
  • 76
  • 102
  • When i use git rebase -i i get `Cannot rebase: You have unstaged changes. Additionally, your index contains uncommitted changes. Please commit or stash them.` –  Jan 17 '17 at 07:21
  • 1
    Well, do as the error tells you. For rebasing you must have a clean workspace, so stash your changes, do your rebase, do your push and then unstash your changes. – Vampire Jan 17 '17 at 09:48