XCode Won't Commit To GIT

≯℡__Kan透↙ 提交于 2019-12-22 12:34:08

问题


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.


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/12204686/xcode-wont-commit-to-git

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!