How to add Xcode project with cocopods to github - ios

I followed this link to add project to GitHub. I could successfully create the repository using these instructions.
But unable to add an Xcode project with pods(.xcworkspace) to GitHub.
I am aware that we shoud add only podfile to reduce the load. But Not sure how to achive this.

After few hours of trial error found the below solution to be working. If anyone have better soultion please suggest.
Open your git hub web, create a new repository with a readme and .gitignore file.
Clone the repo to your machine.Open terminal.
cd your_directory
git clone your_repo_url
copy and paste your existing project folder to this directory("your directory")- make sure you have deleted the local git from this folder Refer this link
open gitignore file and uncommnet the below line.(# Add this line if you want to avoid checking in source code from the Xcode workspace)
*.xcworkspace
In terminal run command git status
This will list out new changes you have done in the folder.
run command git add --all
run commit -m "commit message"
git push
Make sure you have removed large files from your project, files like video audio etc.
While you check out this repository to another folder, make sure you run pod install and create xcworkspace.

Related

Git unable to identify project.pbxproj

Whenever i commit and push project.xcodeproj file, git not able to identify project.pbxproj because it is not showing on remote branch.
If i do some changes in project like add a new file or change project settings etc. but still git unable to identify any changes in project.xcodeproj.
Please help me out.
Finally i got the solution,
I move in project.xcodeproj bundle and forcefully add project.pbxproj file by using below command
git add -f project.pbxproj
Because the project.pbxproj file is packed and embedded in the project.xcodeproj bundle.
You change it , and git add it.
Git not able to identify project.pbxproj because it is not showing on
remote branch.
I think you need some Plugin to open file in Github, like fugitive.vim .

Why Cocoapods ignored when pushing to Git?

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):
And that's what the repo contains (14 files and folders 121MB Size):
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:
git push ignore cocoapods
Commit to git after switching to workspace and adding CocoaPods in Xcode?
without any useful results.
Any advice would be appreciated.
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.)

Git: Libraries hosted in a remote repository?

I'm working in a project that has a few libraries that seem to be in a remote repository. For example:
When I clone the project, all of the libraries with that icon are missing. Is there another command I need to execute to download them?
For reference, this is an iOS project and these are Objective C libraries.
Generally third party libraries are added in project via CocoaPods or git submodules.
If your project using CocoaPods then you will find a podfile inside project directory, open terminal and navigate to directory contain podfile and then type in this command pod install to checkout all libraries, it will create a workspace, once you have workspace open that project via workspace always.
If other libraries are added as submodule then you can checkout using git submodule update --init.
My guess is that they are submodules of the repository you're clonning. Try adding the --recursive option to the clone command.

XCodeproj empty after cloning from Git

I have an Swift project that utilizes two libraries: the SQLite and SwiftCSV project. They can be found on: https://github.com/stephencelis/SQLite.swift and https://github.com/naoty/SwiftCSV respectively. I followed the instructions on each respective Github README to incorporate the projects into my project which works fine, but when I push my project to Github and I have another teammate of mine clone the project, the SwiftCSV and SQLite projects turn up empty so my teammate has to re-add them into his project. I have been trying to google different responses but maybe I am looking for the wrong keywords. Any ideas on how to fix this?
You should (and may be) adding the above projects to your repo as submodules (if not, read up on them).
If you used submodules, they are not automatically checked out when you clone a repository. You can, however, use clone's --recursive flag to ensure submodules are checked out when someone first clones your project:
git clone --recursive git#github.com:your/project.git
If the project has already been cloned, one can check out the submodules by running the following incantation from within their project directory:
git submodule update --init
Note: Xcode is usually smart about letting you check out submodules from within Xcode itself. Check the Source Control menu and see if SQLite.swift or SwiftCSV show up under Working Copies.
If you merely downloaded the projects and dragged them into your Xcode project (rather than use submodules, as instructed above), they'll likely be referencing directories outside of your project. Make sure you move them to your project's directory before dragging them into your Xcode project. If you don't, the projects will appear red/unavailable on subsequent clones.
usually, xcodeproj is in gitignore, please remove it from .gitignore file

linphone compile issue (just downloaded from git)

I followed the instruction from here http://www.linphone.org/eng/download/git.html.
I open terminal and entered git clone git://git.linphone.org/linphone-iphone.git --recursive
(I included --recursive)
But after that I can't compile, because some files are missing:
You can try and repeat the command which is done the "--recursive" part of a git clone (that actually calls git submodule):
cd /path/to/linphone # your main parent repo
git submodule update --init --recursive
And see if there are any error message, or if the missing files show up.
Did you follow the instructions in the README file to compile the sdk first? Linphone for iPhone depends on liblinphone sdk.
The README is quite detailed but is focused on Macports, if you want to use Homebrew have a look here:
http://www.successmonkey.co.nz/blog/building-linphone-for-ios
And for Macports a blog with some more details and some discussion:
http://shallwelearn.com/blog/build-linphone-for-iphone-and-ipad/

Resources