Search code examples
iosgithubversion-controlcocoapodsxcode-workspace

How to add Xcode project with cocopods to github


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.

enter image description here


Solution

  • After few hours of trial error found the below solution to be working. If anyone have better soultion please suggest.

    1. Open your git hub web, create a new repository with a readme and .gitignore file.

    2. Clone the repo to your machine.Open terminal.

      cd your_directory

      git clone your_repo_url

    3. 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

    4. 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

    5. In terminal run command git status This will list out new changes you have done in the folder.

    6. run command git add --all

    7. run commit -m "commit message"

    8. 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.