0

I have a problem to exclude a specific dir out of the git tracking that I once tried to commit and push, as it contains some files inside that are too big to be pushed on the github.

Below is the dir structure.

/git_dir   
  └-foo
    └-.gitignore # "in which I only write '/_data/' "
    └-/_data
      └- XXX.tsv # a large file
    └- other files

What I did:

  1. wrote a .gitignore to exclude the target dir ('/_data')
  2. executed git rm --cache -r .
  3. git add . / git commmit -m 'chore' / git push origin main

Result:

$git push origin main
>>remote: Resolving deltas: 100% (21/21), completed with 2 local objects.
remote: error: Trace: XXXXXX
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File
work/foo/_data/XXX.tsv is 185.07 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.

In addition I experimentally deleted the file (XXX.tsv) and did (1) - (3), which made no change. It seems to me that somehow cleaning the cache is not working well. Would you tell me what causes this and how I can solve the situation? Thank you.

Yosher
  • 643
  • 6
  • 15
  • To supplement, I have read the post below and executed an identical process and it didn't solve the situation. https://stackoverflow.com/questions/46473769/gitignore-not-working-even-when-i-clear-the-cache – Yosher Oct 24 '21 at 16:25
  • According to your output you have a `bar` directory between `foo` and `_data` – Ôrel Oct 24 '21 at 16:31
  • It's just my typo; I fixed it – Yosher Oct 24 '21 at 16:33
  • 2
    If you have already committed the file, it is part of the history, even if you later delete it. You need to "rewrite history" to remove that commit. Look up some tutorials on "interactive rebase", "amend commit", and similar. – IMSoP Oct 24 '21 at 18:44

0 Answers0