I am using a local git repo. When I try to commit changes to the core data model file (.xcdatamodel), I get this message:
error: pathspec '.../DataModel.xcdatamodeld/DataModel.xcdatamodel/contents' did not match any file(s) known to git.
How to fix this and commit the model as I do with any other file?
Git errors: cannot checkout branch - error: pathspec 'branch_name' did not match any file(s) known to git. To fix that you can remove remote origin and link it again. After this you should be bale to switch between the branches as usual.
The problem is, indeed, the changing of a filename's case. For me this was because of my Macbook/OSX. Apparently Windows has the same 'thing'.
Cause: git isn't able to recognise a change from 'filename' to 'FileName'.
Here's a list of solutions for anyone stumbling upon this. All the solutions should be run at the project root:
Change the git case setting. The file should be committed afterwards
git config core.ignorecase false --global
git config core.ignorecase false
git commit -a -m "pathspec did not match any file(s) known to git fix"
Delete the file. Commit. Push. Add the file again. Commit. Push.
Based on your needs you may want to revert the settings. Do:
git config core.ignorecase true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With