1

As a POC, I created a new repository (on BitBucket) and tried to push a dummy project, everything worked as it should; I tried to apply the same exact process on my actual project, which has cocoapods, it has been pushed successfully, but when I tried to checked it out, I got the source code without the pods!

I viewed the source of the repo, it does not contains the pod directory.

Here are the files that I tried to push (16 files and folders, 192MB Size):

enter image description here

And that's what the repo contains (14 files and folders 121MB Size):

enter image description here

Note that the last tow folders in my local machine (Pods and widget) are not in the repo.

There is no .gitignore file.

Also, I checked:

without any useful results.

Any advice would be appreciated.

Community
  • 1
  • 1
Ahmad F
  • 30,560
  • 17
  • 97
  • 143
  • Did you `git add` the Pods directory and its contents? If you do `git status`, what does that tell you w.r.t. the Pods directory? I'm not saying that you *should* add it, but if you think it should be in your repo and it's not, one has to ask. – Caleb Jan 12 '17 at 20:21

1 Answers1

4

CocoaPods is a dependency manager:

The dependencies for your projects are specified in a single text file called a Podfile. CocoaPods will resolve dependencies between libraries, fetch the resulting source code, then link it together in an Xcode workspace to build your project.

You can run pod install to install the pods for your project, which will create and populate the Pods/ directory.

The reason the Pods/ directory isn't in your repository even in the absence of a .gitignore file is probably that it contains other Git repositories (i.e. directories containing their own .git/ directory). Git doesn't track nested repositories.

(It is also possible that Xcode ignores that directory by default, but I'm not an iOS developer so I can't be sure about that.)

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
  • Thank you for your answer. After reading some articles -related to [this subject](http://stackoverflow.com/questions/9446644/what-goes-into-your-gitignore-if-youre-using-cocoapods)-, I can see that pushing the pods is a good idea... do you think that should I follow [this approach](http://stackoverflow.com/questions/5814319/git-submodule-push)? – Ahmad F Jan 15 '17 at 07:02
  • @AhmadF, submodules are useful but they work differently from how many people expect. It's important to spend some time learning about them to see if they fit your situation. Have you confirmed that your `Pods/` directory indeed contains other Git repositories? – ChrisGPT was on strike Jan 16 '17 at 12:28
  • What I did is adding `Pods/` manually, as mentioned in [this answer](http://stackoverflow.com/a/5814351/5501940) and it worked fine, Actually, each directory in `Pods/` should be a separated repo, this is how CocoaPods works (I assume as mentioned in your answer that's why it get ignored), but the weird thing that I checked the directories and there is no .git directory for each one, but if this would be useful, there is a "README.md" file. – Ahmad F Jan 16 '17 at 13:08