xcodegitterminalrepositoryopenears

Removing a weird file from git repository on mac


I recently tried adding the OpenEars framework to my xcode project, and when I tried to commit my project to the repository I get the following error:

error: pathspec '"Framework/Icon\r"' did not match any file(s) known to git.

I have tried to find this file using the navigation tree within xcode but it doesn't exist. There is a physical file on the disk which was 0 bytes (this is most likely the problem), and I tried removing this with no affect.

I tried to navigate to the file using terminal and use git rm Icon\r but due to the \ in the name it cannot find the file:

$ git rm Icon\\r
fatal: pathspec 'Framework/OpenEars.framework/Icon\r' did not match any files

Has anyone had a similar issue or know how I can remove this file as it is stopping me from pushing any changes.


Solution

  • Try cding into the directory, then start typing the following until you get to the I in Icon\r. Then press the Tab key to have the Terminal automatically complete the rest of the path. It will look like this:

    git rm Framework/OpenEars.framework/Icon^M

    NB: There is a space after the M. Entering in this full path does not seem to work: only allowing the Terminal to autocomplete the path for you will.

    I got:

    MacPro:OpenEarsDistribution mdouma46$ git rm Framework/OpenEars.framework/Icon^M 
    'm 'Framework/OpenEars.framework/Icon
    MacPro:OpenEarsDistribution mdouma46$ git status
    # On branch master
    # Changes to be committed:
    #   (use "git reset HEAD <file>..." to unstage)
    #
    #   deleted:    "Framework/OpenEars.framework/Icon\r"
    #