2

Currently, we are forced to migrate our repository from Gitlab to Github. When we want to push our repo to Github with "git push -u origin master". Unfortunately, this results in the following errors (Copied Output 1):

remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.

remote: error: File Data/Setup/Database.2.7.0.1.accdb is 426.50 MB; this exceeds GitHub Enterprise's file size limit of 200.00 MB

remote: error: File Data/DPM/Database 2.4.0.0.accdb is 422.12 MB; this exceeds GitHub Enterprise's file size limit of 200.00 MB

remote: error: File Data/Setup/Database 2.5.0.1.accdb is 422.00 MB; this exceeds GitHub Enterprise's file size limit of 200.00 MB

remote: error: File Data/Setup/Database 2.6.0.0.accdb is 421.98 MB; this exceeds GitHub Enterprise's file size limit of 200.00 MB

(and more ...)

It's insufficient to remove the file, because it is included in previous commits. We tried the following fix suggested in: https://medium.com/@mrkdsgn/fixing-the-gh001-large-files-detected-you-may-want-to-try-git-large-file-storage-43336b983272 . We tried to remove all the accessdatabases from our entire repo using the following command:

git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch Data/\*accdb'

The output is as following (Copied Output 2):

(starting from 1/1398...)
Rewrite 9f3d64449f73d663bfa3c657b7a9406bb153d040 (1394/1398) (2452 seconds passed, remaining 7 predicted)    rm 'Data/Setup/Database.2.7.0.1.accdb'
Rewrite 8804497bd5d2db157deb3f169764bd230fbd5379 (1395/1398) (2454 seconds passed, remaining 5 predicted)    rm 'Data/Setup/Database.2.7.0.1.accdb'
Rewrite de9e3cc72501c056696b7e327e5c957016f69247 (1396/1398) (2456 seconds passed, remaining 3 predicted)    rm 'Data/Setup/Database.2.7.0.1.accdb'
Rewrite c6cb5be434b7ad7a132a383995add34fe6176506 (1397/1398) (2457 seconds passed, remaining 1 predicted)    rm 'Data/Setup/Database.2.7.0.1.accdb'
Rewrite 01f39409430cd15a638c99f788a8acce69b9de0b (1398/1398) (2459 seconds passed, remaining 0 predicted)    rm 'Data/Setup/DPM Database.2.7.0.1.accdb'

Ref 'refs/heads/Branch_Jack' was rewritten

It looks like we removed all files with .accdb extensions that appeared in the "exceed Github limit" error. But unfortunately, when we execute "git push -u origin master" again, we receive the same errors as in (Copied Output 1).

Does anyone have suggestions what we did wrong? How can we delete the accesdatabases in our repo?

PS. We tried the method as described in https://git-scm.com/book/en/v2/Git-Internals-Maintenance-and-Data-Recovery under "removing object" as well. The additional steps of garbage collect and git prune -expire now did not solve the problem.

Mickael
  • 4,458
  • 2
  • 28
  • 40
Jack
  • 23
  • 2
  • Possible duplicate of [How do you fix a bad merge, and replay your good commits onto a fixed merge?](https://stackoverflow.com/questions/307828/how-do-you-fix-a-bad-merge-and-replay-your-good-commits-onto-a-fixed-merge) – Liam Aug 13 '18 at 12:46
  • 1
    @Liam - That would be the case if they were updating an existing ref. In the target repo, they've never been able to push, so this is creating a new ref. There is no need to use `-f` and no pre-existing ref to worry about overwriting, provided the account given in the question is complete and accurate. – Mark Adelsberger Aug 13 '18 at 12:47

1 Answers1

1

I guess the most likely problem is if you aren't filtering the entire history of master. The filter-branch command you gave will only filter the history of the current HEAD. If you're only going to push master, you could say

git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch Data/\*accdb' -- master

Or, if you want to remove the file from the entire repo history, you could say

git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch Data/\*accdb' -- --all

Keep in mind that before running another filter-branch command, you'll have to remove the original/ refs (if you haven't already). (These refs would also thwart attempts to clean up the local repo with gc, but I doubt that's really an issue. The pack sent to the server should only contain reachable objects... I don't know that the docs guarantee this behavior, but I don't think I've ever observed otherwise.)

If that still doesn't fix it, we may need more information. Make sure the error message is still exactly the same (not just the same general error, but maybe referring to other objects/paths, for example).

Mark Adelsberger
  • 42,148
  • 4
  • 35
  • 52
  • You saved my day! Your suggestion to remove the file from the entire repo history with --all worked! – Jack Aug 13 '18 at 15:36
  • For future problems that are similar, I did remove the originals/refs using gc as described in https://git-scm.com/book/en/v2/Git-Internals-Maintenance-and-Data-Recovery under "removing object". This might be part of the solution. – Jack Aug 13 '18 at 15:53