0

In my project directory, there is a directory called docker/, under which there's another directory volumes/, under which there are sub-directories. The directory structure is like:

my-project/
    - docker/
        - volumes/
            - data/
               ...
            - other-data/
               ...
.gitignore

I need git to ignore everything under directory docker/volumes/ since there are large files under it. Since I already committed .gitignore , now I need to update .gitignore . So, I opened .gitignore & updated it to:

...
docker/volumes/*

After saved it. I run:

git rm -r --cache .

Then, I git add . & run git commit -m "update gitignore & reset cache".

Then, I git push origin master

But I still get error:

remote: error: Trace: 103f63186285fad8994c61ba22338c97bb63f7d3a31c782e4a20f0a837bf73b3
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File docker/volumes/data/default/00000000000000000000.snapshots is 256.00 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File docker/volumes/other-data/default/00000000000000000000.events is 256.00 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.

I mean I should have already asked git to ignore everything under docker/volumes/, or aren't I?

user842225
  • 5,445
  • 15
  • 69
  • 119
  • Have you added/committed it before adding it to the `.gitignore`? – dan1st Aug 13 '21 at 20:16
  • Yes, like I said I have committed `.gitignore` before that's why I later have run `git rm -r --cache .` to reset cache in order to have updated `.gitignore` take effect. – user842225 Aug 13 '21 at 21:18
  • The use of `git rm` affects *future* commits. *Past* commits—those you already made, that have the large files in them—are still there in your repository, holding the large files. You'll need to replace or remove the *past* commits, which is nontrivial (but possible). – torek Aug 13 '21 at 23:29
  • @torek does it only apply for large files? Because I have been using `git rm -r --cache .` all the time when updating already committed `.gitignore`, it has been working. I get very confused by what you said. Could you please further explain or provide reference? – user842225 Aug 14 '21 at 06:24
  • Yes, in this particular case, it applies only for large files, because it's just the large files inside commits that are a problem for GitHub. See the linked duplicate. There are reasons it has 834 upvotes and 25 answers (at this time): there's way more to this than will fit in a comment. – torek Aug 14 '21 at 07:30
  • @torek Thank you very much! I will check that. BTW, I have then tried https://git-lfs.github.com/ as an alternative option for large file handling, but for some reason it is not working for me either, I know it must be my problem not the tool, so I will post another question concerning my usage of that tool. – user842225 Aug 14 '21 at 13:14
  • I'll note that I have not actually *used* LFS on GitHub: at a previous $work we tried an experiment with it but weren't thrilled with the result, and went a different way. (That was years ago now so it might have changed some since then, too.) – torek Aug 15 '21 at 01:09

0 Answers0