I have a main "app" folder that's the root of the git repository. Inside here, I have "ios-app" folder where my Xcode xcworkspace resides among other folders like "android-app", "backend", etc. Surprisingly, Xcode does show the status of the files (i.e. M for modified) and I am able to use Fetch Changes menu option, but I am unable to either commit with Xcode or view the file in the code review editor.
Error when opening code preview:
The source control operation failed because the file “...” could not be found.
Make sure a valid file exists in the repository and try again.
Error when committing:
The working copy “...” failed to commit files.
error: pathspec 'app/ios-app/DataModel/EventMutations.swift' did not match any file(s) known to git
Nothing interesting in Console app, but the below details may be relevant:
[MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-17220/IDEKit/CommandsAndSelection/IDEMenuBuilder.m:203
Details: Unknown submenu: "Xcode.IDEPegasusSourceEditor.MenuDefinition.SourceCodeAuxiliaryEditorMenuItem3" in menu: "Xcode.IDEPegasusSourceEditor.MenuDefinition.Editor"!
Object: <IDEMenuBuilder>
Method: +_menuItemForMenuItemElement:inMenuWithIdentifierUsedForDebugging:forViewController:fillingExtensionIdToMenuMap:
Thread: <NSThread: 0x7fb3aa517540>{number = 1, name = main}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
At one point I did rename my folder from "iOS-app" to "ios-app" so to preclude the case that this might be git's case sensitivity, I did run git config --global core.ignorecase true
, but this does not resolve the issue.
I have also tried to remove the project from Xcode's "Welcome to Xcode" page and add them back in case this affected how the gitpath is determined.
All file paths in Xcode seem correct and "Show in Folder" option always works.
I am also able to correctly view the git project in the Source Control Navigation:
TL;DR: double check that the case of the local folders & files matches the case of the remote folders and files. Also, double check that your local project's case sensitivity has been enabled (local overrides global git settings), otherwise, git status will pretend that there is nothing going on.
In my case, I locally renamed iOS-app
to ios-app
, but did not push this to remote branch, so Xcode was trying to find the lower case version and couldn't!
Seems like Xcode by default has case sensitivity enabled, whereas git's can be configured.
> git config core.ignorecase
true
> git config core.ignorecase false
> git status
New files detected:
ios-app/
android-app/
git mv iOS-app ios-app
, it will not rename 😡. What you need to do is rename iOS-app
to some temporary name, then back to ios-app
.> git mv iOS-app iOS-app-foo
> git mv iOS-app-foo ios-app
> git add -A
> git commit -m "Make sure that local and remote have the same case."
> git push
Restart Xcode and you should be good to go!
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