Git not able to recognise addition of .xcscheme files in xcode project

给你一囗甜甜゛ 提交于 2020-07-05 07:18:18

问题


Added a new scheme corresponding to a test target in my xcode project. The new xcscheme file created is not getting reflected in git. Also doing a git status shows me nothing to commit, working directory clean .

Trying to add it through terminal by git add .xcscheme says

The following paths are ignored by one of your .gitignore files: MyProject.xcodeproj/xcshareddata/xcschemes/MyProjectTests.xcscheme Use -f if you really want to add them

On verifying my .gitignore file, its completely blank.

I went through posts which asks to make the schemes shared but it did not help. Went through this thread, Bitbucket not showing changes in themes directory . But for me, there is no .git or .gitignore files inside either of the .xcodeproj file or xcschemes directory.

How to remove these restrictions so that I can add the new xcscheme file to the repo or is there any other settings that I need to modify?


回答1:


There are multiple places for gitignore settings. Check them all.

See the documentation such as http://git-scm.com/docs/gitignore




回答2:


even though this has already been answered... for me it was

make sure your scheme is set to "Shared". Schemes dropdown -> manage schemes -> check the "Shared" box for the schemes you want to commit

hope this helps someone :)




回答3:


You'll need to go into the "Manage Schemes" view and check off the 'Shared' checkbox

'Product' menu -> Scheme -> Manage Schemes

That will create the shared scheme files. Next, you'll need to make sure the files are not ignored by git.

You'll need to remove 'xcshareddata/xcschemes' from your ignore file and add them to the repo

or just use

'git add -f MyProject.xcodeproj/xcshareddata/xcschemes'




回答4:


One thing I noticed that somehow .xcscheme file was added to the global git ignore. As suggested by other guys I did next:

  1. To find path of global git ignore file I used this git config --get core.excludesfile
  2. Then I opened it and checked for any .xcscheme
  3. I removed .xcscheme restriction (in my case it was file name + extension added to global git ignore ProjectName.xcscheme)
  4. Then I navigate to project folder via terminal and check git status
  5. Now I saw that I have one .xcscheme untracked file. I have added it via git add function and committed
  6. But when I switched to another branch I still could not applied .xcscheme to this branch.
  7. The solution was to open Manage Schemes and unselect and then select Shared checkmark next to my scheme.
  8. Now after git status I can see .xcscheme untracked file and can commit it to the new branch.

Just my experience of using answers above. Thanks all guys!



来源:https://stackoverflow.com/questions/32753798/git-not-able-to-recognise-addition-of-xcscheme-files-in-xcode-project

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