How To: Version control with Xcode 4 and GitHub?

Reading time ~1 minute

As I’m going to build an iPad prototype for my graduation project and like to have it open source, I decided to go for GitHub (Online project hosting using Git. Includes source-code browser, in-line editing, wikis, and ticketing. Free for public open-source code.) since I have good experience with this service during my Ruby on Rails developments and it’s now implemented in Xcode 4. However, the implementation is fairly buggy to work with a remote repository. There are two guides I found to set the repository up, but both didn’t work completely, so here’s my version which worked fine.

  1. Open Xcode
  2. Create a new Xcode project. In the dialogue for source control make sure the local git repository is checked and will be created
  3. Quit Xcode (command+Q)
  4. Go to (create a user, if you don't have one yet) and create a new repository
  5. Open your, go to the project folder ("cd ~/YourDevelopments/YourProject" and follow the GitHub Global setup:
    • git config --global "Your Name"
    • git config --global
  6. Follow the "Existing Git repo?" steps:
    • git remote add origin
    • git push -u origin master
  7. Go back to GitHub and click "continue"
  8. Your source data should be uploaded there and listed with the message "Initial Commit"
  9. Open your Xcode project
  10. After changing some files (f.e. changing from iPhone to iPad app) go to File->Source Control->Commit and write a short info/documentation of what you did (f.e. "Changed to iPad App"). Make sure all items are ticked in the left browser and press "Commit"
  11. Go to File->Source Control->Push. There will be an error, that your username is not correct, just ignore that. Go to File->Source Control->Push again and press "Push". There will be an error saying the push was not successful, ignore that too and Push again (File->Source Control->Push, "Push". You should get a message that there are no uncommitted changes in the project
  12. Check the repository on GitHub, it should show the changes now

This is of course extremely buggy and not “the apple way”, but I guess the next implementation will be more stable.


Europe on Two Wheels

![Iron 883](/images/2015/07/IMG_7368.jpg)## Barcelona (Spain) - Le Dramont, Cote d'Azur (France)> 648km![Le Dramont](/images/2015/07/IMG_...… Continue reading


Published on September 10, 2014

HTML5 vs. Native [thoughts]

Published on February 26, 2014