XCode Won't Commit To GIT

2019-05-23 02:50发布

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.

2条回答
Summer. ? 凉城
2楼-- · 2019-05-23 03:09

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

查看更多
Juvenile、少年°
3楼-- · 2019-05-23 03:12

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.

查看更多
登录 后发表回答