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

6

15

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?

Cypress answered 24/9, 2015 at 5:10 Comment(0)
Z
2

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

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

Zayin answered 24/9, 2015 at 5:19 Comment(2)
Yes, there is a file name .gitignore_global with all the file extension mentioned. I did not knew about this. Do you have information on how this file got added with all those file extensions mentioned pre filled in it? Morover, if I do edit this file and add the xcscheme file to the repo, will the change reflect to other developers. Will it be possible to edit this file and commit and push it to the central repo ?Cypress
Maybe setting up XCode or github created this default gitignore. Note that some xcscheme files are personal, and thus should not be checked in, while others are shared. See #49978Zayin
S
23

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 :)

Sorgo answered 1/6, 2017 at 17:36 Comment(1)
This should be the first thing you check!Letterperfect
K
12

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'

Kalvn answered 28/8, 2018 at 9:8 Comment(0)
C
3

For me it was different, schemes weren't added to .gitignore and all of my schemes were already checked off as shared under "Manage Schemes". But Git didn't recognise them.

The solution that worked was unchecking shared for all schemes and checking them again.

'Product' Menu -> Scheme -> Manage Schemes -> Uncheck Shared -> Check Shared
Cryptic answered 27/10, 2021 at 21:19 Comment(0)
Z
2

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

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

Zayin answered 24/9, 2015 at 5:19 Comment(2)
Yes, there is a file name .gitignore_global with all the file extension mentioned. I did not knew about this. Do you have information on how this file got added with all those file extensions mentioned pre filled in it? Morover, if I do edit this file and add the xcscheme file to the repo, will the change reflect to other developers. Will it be possible to edit this file and commit and push it to the central repo ?Cypress
Maybe setting up XCode or github created this default gitignore. Note that some xcscheme files are personal, and thus should not be checked in, while others are shared. See #49978Zayin
O
1

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!

Orthogenesis answered 21/4, 2020 at 16:36 Comment(0)
D
0

Since the scheme file .xcscheme was added to global git ignore. Please mark it in ignore and prepare to commit it. The .xcscheme would appear in git.

find global git ignore

mark .xcscheme

.xcscheme appears in git

Disreputable answered 5/8 at 3:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.