1

So I recently uploaded my react-native project on GitHub, then cloned it back to see how it will build(did it for first time... yeah). And on react-native run-ios I got a repetitive error: "react-native-app/ios/Pods/Target Support Files/Pods-testAppTests/Pods-testAppTests.debug.xcconfig: unable to open file (in target "testAppTests" in project "testApp") (in target 'testAppTests' from project 'testApp') I found a solution, where this:

cd ios
pod deintegrate
pod install

helped me as the project then built and ran correctly. So my question is, how to upload it to GitHub in a way so it builds always correctly after cloning it?

Update

Checking and editing .gitignore solved this problem.

Mod3rnx
  • 828
  • 1
  • 10
  • 21

1 Answers1

1

Maybe this is linked to files which have been added/committed, while they should have been ignored, private and local only (not uploaded to GitHub)

Check your .gitignore: here is one for ReactNative, as explained in "Creating a .gitignore for a Clean React Repository", blog post written by Parker Johansen.


Then, assuming you don't have any pending changes/work in progress, you can, as explained here, apply your new .gitignore to your existing repository:

cd /path/to/local/cloned/repo
# create your .gitignore
git rm -r --cached .
git add .
git commit -m ".gitignore is now working"
git push

Finally, clone it again, and see if it compiles better.


The OP adds in the comments:

I found that folder 'Pods' doesn't exist on GitHub, that's why this error occurs, how can I add it to my /ios folder on Github correctly

I advise to check if there is a .gitignore rule which would ignore said folder:

git check-ignore -v Pods/aFile_inside_Pods
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Well, it's not a .gitignore problem, I found that folder 'Pods' doesn't exist on GitHub, that's why this error occurs, how can I add it to my /ios folder on Github correctly? – Mod3rnx Mar 19 '20 at 10:34
  • @Oleksii Can you check if that folder is not already ignored, with `git check-ignore -v Pods\aFile_inside_Pods`? – VonC Mar 19 '20 at 10:55
  • yup it found it # CocoaPods /ios/Pods/, should I just remove this from .gitignore and then push? – Mod3rnx Mar 19 '20 at 11:01
  • @Oleksii Yes, provided you git add the Pods folder content, commit and push – VonC Mar 19 '20 at 11:04