Xcode - error: pathspec '...' did not match any file(s) known to git

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:

The Permanent fix that will work on current and future projects

Change the git case setting. The file should be committed afterwards

git config core.ignorecase false --global

The Project only fix

git config core.ignorecase false

The just give me a line of code so I can move on fix - credit to Bruce

git commit -a -m "pathspec did not match any file(s) known to git fix"

The I get paid by the hour 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 

I solved the problem simply by closing XCODE and opening it again. I know it is not a cool solution, but it worked without any changes to any files on my part.


I got the same error using xcode 9.1. I solved it by manual commit from the terminal. The steps are as follows

  1. move to your project folder/directory
  2. $ git status - you will get to know the changes done to your project
  3. $ git add .
  4. $ git commit -m"your message"
  5. $ git push origin master

Once you manually commit all the changes successfully from the terminal, then you can use source control in xcode.


This is not a proper way to solve the problem, but it's a workaround that may help others... Do this in your terminal:

git commit -m "<message>" <project dir>

Replace with your message, and with the directory of your project.