2

Been googling for a while with no luck.

I have been working on my app for a week and I'm trying to commit to git now, so I can start branching and try some new stuff. But I can't commit my changes. I get the following message:

"The working copy "APP NAME" failed to commit files.

fatal: Could not switch to '/Users/Leonne/Documents/iOS Projects/APP NAME/APP NAME/Resources': No such file or directory"

I have initialized the git repository. I don't understand what could be going on. Before, I did create a "Resources" folder, but deleted it afterwards. I never committed with the existence of this "Resources" folder. I deleted the Resources folder because it was giving me troubles whenever I tried to compile my app. I'm working with XCode 4.4.

Any help will be appreciated.

Andy Ibanez
  • 12,104
  • 9
  • 65
  • 100
  • did you add the Resources folder under git control and then deleted it by hand? – jere Aug 30 '12 at 20:14
  • I created the resources folder and then dragged it to XCode. Looking a bit deeper, I found the Resources folder in the git Window, but I can't seem to delete it. I can only untick the files it contained but not the folder itself. – Andy Ibanez Aug 30 '12 at 20:15
  • did you try opening up a console, navigating to the folder that contains the Resources folder, and running `git rm Resources`? – jere Aug 30 '12 at 20:21
  • Fixed. Will add my answer in a sec: – Andy Ibanez Aug 30 '12 at 20:23

2 Answers2

2

Ok, I just experienced this problem today morning. I don't know if mine is THE perfect fix. My Mac crashed and I restarted, and I could commit again.

If my fix hold true with you as well, then it could be a bug with XCode.

Edited

It seem my error still exists and the following is my fix.

It seem Xcode GUI have some problem with using GIT properly. So i used the terminal to do this. I went to the working directory and then did a git status this will show you a list of files that were deleted/modified/added. You can manually add them all together using git add or just a straight git commit -a (not recommended on complex projects)

This solved the commit issues and when i went to Xcode, the error doesn't seem to exists anymore

Steven
  • 974
  • 6
  • 18
1

Looks like I have the bad habit of solving my hour-long problems 5 minutes after I post about them on StackOverflow, haha.

My fix was rather easy. I navigated to the specified route and re created the Resources folder. I added the folder to my project via XCode's "add files" feature. Directly afterwards I deleted it from there, moving it to trash. Now I can compile and commit, thank goodness.

Andy Ibanez
  • 12,104
  • 9
  • 65
  • 100