0

I have a repo containing large files, and I regularly push the repo to two remotes, let's say github and origin. github requires lfs for files larger than 100MB, no problem, I track those files and push to github successfully.

But the problem is, origin doesn't support lfs, but it doesn't have that 100MB file size limit. So when I push the repo, it failed.

What I want to achieve is, track those large files using lfs for github, and untrack them (treat them as regular files) for origin, how to do that?

tjysdsg
  • 656
  • 8
  • 19

1 Answers1

0

There isn't a way to do that without maintaining two separate, divergent histories. Git LFS requires that pointer files (small files referring to the large files) are stored in your repository. Because every commit's object ID is dependent on every blob, tree, and commit that it refers to directly or indirectly, you cannot have one history where files can be either LFS or not.

bk2204
  • 64,793
  • 6
  • 84
  • 100
  • What about branches, do they need to have separate history? – tjysdsg Jul 15 '20 at 01:38
  • If you're asking if you can have two separate branches where one has LFS files and one does not, then yes, but they won't share history and you won't be able to merge or cherry-pick effectively. If you want to merge, rebase, or cherry-pick effectively between branches, they need to share history, and so can't have the setup required for your scenario to work. – bk2204 Jul 15 '20 at 01:45