How do I make sure my podfiles work in my GitHub repository - swift

I'm working on an Xcode project (Swift) that utilizes cocoapods. After completing my tasks, everything worked. I then committed and pushed to my GitHub repository. Then I downloaded the project as a zip from the repository to make sure everything was good. Everything looks fine, but the pods are not there. As a result, in the downloaded version the pods are in red. Is there any way to fix this?
(sorry if this is really simple, I'm just new to GitHub and I haven't found a solution anywhere online)

The question here is basically: How do I make everything compile after cloning/downloading my project.
It seems that you did not commit your Pods into your source control, so the short answer is: Just run pod install
If you want more details about wether you should commit your Pods or only your Podfile, and about Cocoapods in general, this guide is a good starting point.

When you push everything to github, you will need to check the “select all files”. so that your push to github actually sends the pod directory and the Podfile.lock.
Sometimes you need to manually go into the proj3ct directory in terminal and type “git add .” (Hope that’s the command)
Check your github repo and see if they exist and contain files.
You probably don’t have a .gitignore, but if you do, the. Make sure that you are not ignoring pod files. Otherwise they will never be written to the repository.
If the pod files are in the repo you shouldn’t need to do a pod install. But if all else fails, that’s what you need to do.

Related

how to delete submodule in github that was added by accident

I'm trying to put on frontend project on Netlify, however, when i'm trying to deploy it i'm getting the below error message
how can i get rid of the submodule?
see below my github page
Although your question is not properly define what you want to delete.
But according to me, you want to delete one folder which you already deployed to netlify so what you can do is go to your VS Code and delete that particular folder from there and then again pushed the updated project to GitHub and then wait for some minutes it will reflect on your netlify.
If this won't work then reverts back.

Xcode keeps adding/deleting random files

I am using GitHub desktop for source control, but for some reason there will randomly be thousands of changes that I did not make, sometimes adding files sometimes deleting. Not sure why this is happening or how to stop it but it is making it very difficult to commit the actual changes I want.
This isn't only happening with the pods, it's happening with all files including duplicated assets
Not sure why this is happening or how to stop it but it is making it very difficult to commit the actual changes I want.
From your screenshot, it looks like all the changes are in the Pods directory, suggesting that you're probably running Cocoapods commands that install and/or update your cocoapods, e.g. pod install or pod update. As a dependency manager, the job of the pod command is to manage the third party components that you've installed in your project, so it's no surprise that that command changes files in your project as those components are updated.
There are at least two ways to manage those changes, both of which are fully described on cocoapods.org. In a nutshell, you can:
ignore the Pods directory: Set up your .gitignore file so that git ignores the Pods directory. All the information you need to reproduce a given configuration of your project is stored in the Podfile and Podfile.lock files (which are stored outside of Pods), so there's no need to commit all the files belonging to all the pods to your source repo.
don't run commands that update pods: You can go ahead and track all the files in Pods if you want to, e.g. if you're worried that some of the pods you need might disappear and prevent you from building your project. If you do, you need to be aware that running any pod commands that update the installed pods may change any of the files in Pods, so you'll need to avoid running them except at those times when you specifically want to update the installed pods.
Update: After I posted the above answer, you commented to say that more files are affected than just those in your Pods directory, and you added another image. That image shows that the affected files have .icloud file extensions, which suggests that the files are being stored in iCloud rather than on your local drive; the files ending in .icloud are placeholders for files that haven't been downloaded to your computer. To avoid that, ensure that your project directory exists locally rather than on some iCloud volume.

Github actions failed to deploy Jekyll website on Github pages

I have setup a local Jekyll site that is configured to deploy to Github pages. I used the "Chirpy" theme (see https://github.com/cotes2020/jekyll-theme-chirpy) and followed the instructions successfully to get it to deploy the first time.
I am trying to get my 2nd commit w/ updates to deploy but the process is failing when the Github action runs. I see this output:
This is my first attempt at any of this so don't have any perspective on what is going on w/ any of these technologies.
Thanks for any help and LMK what else might make things clearer!
It seems like after you run test.sh, you tried to switch branches. I suspect that is the problem because it doesn't appear that you tried to git reset or anything like that. I believe your test.sh ran (see these lines) so there are unstaged changes.
If you don't want those changes, you might try a git stash to easily reset. Just a thought.
So the issue was that I checked in the _site and .jekyll-cache directories. Here is the proper .gitignore entries to have the standard gh-pages branch build w/o this problem.
https://github.com/github/gitignore/blob/master/Jekyll.gitignore

How do I make a repository for an xcode project with Pods?

Ive been trying to add a Xcode project to a repository on GitHub and it worked however the pods are not within the project and says they are missing. What is the proper way to add a project with the pods to GitHub?
It depends on what your project needs are.
Benefits of checking in the Pods directory
After cloning the repo, the project can immediately build and run, even without having CocoaPods installed on the machine. There is no need to run pod install, and no Internet connection is necessary.
The Pod artifacts (code/libraries) are always available, even if the source of a Pod (e.g. GitHub) were to go down.
The Pod artifacts are guaranteed to be identical to those in the original installation after cloning the repo.
Benefits of ignoring the Pods directory
The source control repo will be smaller and take up less space.
As long as the sources (e.g. GitHub) for all Pods are available, CocoaPods is generally able to recreate the same installation. (Technically there is no guarantee that running pod install will fetch and recreate identical artifacts when not using a commit SHA in the Podfile. This is especially true when using zip files in the Podfile.)
There won't be any conflicts to deal with when performing source control operations, such as merging branches with different Pod versions.
Source
I personally have the following in my .gitignore file:
# CocoaPods
#
Pods/

CocoaPods and GitHub forks

This is my first time forking a GitHub project, and I'm not too competent with CocoaPods either, so please bear with me.
Basically, I forked a project on GitHub using the following in my Podfile:
pod 'REActivityViewController', '~> 1.6.7', :git => 'https://github.com/<username>/REActivityViewController.git'
I then made some changes to the fork, and of course when I did a pod install to install another pod it reinstalled the original REActivityViewController and erased my changes.
I'm realizing I need to push my changes to my fork before another pod install, but how do I know it is the fork being installed, considering that this is a repo installed by CocoaPods? I looked in the REActivityViewController folder installed under the Pods folder and there aren't any git files.
Do I need to work on my fork outside of my project and then use CocoaPods to install the changes? That's too cumbersome of a workflow.
Or do I need to do something with submodules?
I will answer this question using an example. I have a fork of TTTAttributedLabel with some extra functionality I added here:
https://github.com/getaaron/TTTAttributedLabel
In order to use this in a Cocoapods project, I:
Push my changes to my fork
Configure my Podfile to get the changes & update
Once you've pushed your changes to your fork, get the SHA of your last commit. You can do this using git rev-parse origin/master | pbcopy or on the GitHub commits page for your project:
Then, you can specify the specific commit on your fork in your Podfile like this:
pod 'TTTAttributedLabel', :git => 'https://github.com/getaaron/TTTAttributedLabel.git', :commit => 'd358791c7f593d6ea7d6f8c2cac2cf8fae582bc1'
After that, pod update will update this particular commit from your fork. If you want, you can also make a podspec for your fork, but I find this approach simpler and I don't make changes frequently enough to justify a new workflow.
Do I need to work on my fork outside of my project and then use Cocoapods to install the changes? That's way to cumbersome of a workflow.
You can do it this way, but I usually:
Edit the code inside my project and make sure it works
Copy the changes over to my fork, by
exporting a patch, or
copying over the entire source code file
Commit & push to GitHub
Update the Podfile with the new SHA
Run pod update.
Or do I need to do something with submodules?
No, you don't need to.
Another option is to have your project reference the pod directly and not via github. This way you don't have to keep committing your fork or copying/pasting code just to test your changes. You can work with two different Xcode projects simultaneously and commit separately into their respective projects.
pod 'AFNetworking', :path => '~/Documents/AFNetworking'
CocoaPods Documentation:
http://guides.cocoapods.org/using/the-podfile.html#using-the-files-from-a-folder-local-to-the-machine
CocoaPods and GitHub fork
You have two variants to work with fork
[Podfile specific branch]
[Podspec specific branch]
The difference is in the first variant you must push changes into remote/origin branch, while the second variant allows you just commit changes in a local branch