1

I have this file under assets/fonts/myFont.otf

I can't check it into my repo. But it is not ignored as far as I can tell.

git checkout assets/fonts/myFont.otf
error: pathspec 'assets/fonts/myFont.otf' did not match any file(s) known to git.

But adding it has no effect.

git add assets/fonts/myFont.otf

I can't get git status to show the file in any way.

I have tried so far:

  • git add -f
  • git update-index --no-assume-unchanged
  • git config --global core.excludesfile
  • checking all .gitignore files in the project
  • Changeing the file ending from .otf to .ttf -> It works
  • Moving /assets/fonts/* to . -> It works
  • git check-ignore assets/fonts/* -> empty output

I could not find out why *.otf files are ignored in my assets/fonts/ folder. Any other things that I can try to find out? Any Ideas what might cause this? OS is macos 13.14.6

Simson
  • 3,373
  • 2
  • 24
  • 38
David Schumann
  • 13,380
  • 9
  • 75
  • 96
  • 2
    Can you provide a [mcve] for reproducing this issue? What does `git status` say? – Ulrich Eckhardt Oct 14 '19 at 11:54
  • the repo is quite big. I went through all .gitignore files and couldn't find a rule that would cause this. Shouldn't `git check-ignore` find those files? See edit, git status does not list those files, unless i change their ending or move them – David Schumann Oct 14 '19 at 11:59
  • What about `git status --ignored --untracked-files` ? – AlexisBRENON Oct 14 '19 at 12:05
  • the folder shows up with the file that is supposed to be ignored: `assets/fonts/.DS_Store`. `myFont.otf` does not show up – David Schumann Oct 14 '19 at 12:33
  • Can you reproduce this in a new repo in isolation? What about on a different OS? What if you reset global or per-user git settings to their default? – Ulrich Eckhardt Oct 14 '19 at 16:06
  • 2
    MacOS file systems are case-folding by default. Perhaps the *committed* file is spelled differently, e.g., `assets/fonts/MYFONT.OTF` or `assets/FONTS/myFont.otf`. – torek Oct 15 '19 at 01:03

2 Answers2

1

I had the same problem once. The best solution was to copy folder, then you can clone the project, copy your new files into the cloned folder.

Force (-f) normally should add even ignored one.

Another solution was to remove the .git folder if I good remember.

(can't add a comment...sorry)

Slideroh
  • 41
  • 13
1

So the solution was found with the help of toreks hint.

Apparently MacOS file systems are case-folding by default.

So after removing the folder assets/fonts, I saw in git status, that the file was checked into git with a different capitalization:

deleted:     assets/fonts/MyFont.otf

So after I added that deletion to my staging area, everything worked and was registered as would be expected. I would still say git should handle this differently.

David Schumann
  • 13,380
  • 9
  • 75
  • 96