xcode 4.1 with github for Version Control and Co-Development

By September 15, 2011 February 18th, 2015 IT Stuffs

One new cool feature with Apple Xcode v4.1 is the support of git and SVN. git and SVN are free open source version control software. This is extremely useful if you are developing software with other people as a team, or you want to be able to rollback to a pervious revision in case you made some mistakes.

For me as an one person developer, I still think version control is useful because I can go back in case I made a mistake. Also, it is useful for me to do development on multiple systems since I can use a version control server as a central repository for all my codes. I can go to one of my Mac machine, download the latest codes I worked on, and then upload it back to the repository once I am done so I can continue my work in some other places, some other Mac machine.

For my environment, I use git since Xcode v4.1 seems to be integrated with git very well. Without any additional configuration, Xcode v4.1 by default already uses git to do version control locally on your development system. You can go to File –> Source Control –> Commit to save a copy locally, and File –> Source Control –> Pull to choose a revision to go back to, or to compare codes in different versions. Details are available on Apple Development web site


To do what I want to do, I need a website that can act as my git server to host my git projects so I can work on my codes on any Mac machine, anytime, anywhere. I choose http://www.github.com because it is free and it takes 30 second to create an account. Here are the steps on how to make my Xcode v4.1 works with github service:

  • go to http://www.github.com and create an account. All you need to do is enter username, password and email address information.
  • once this is done, github has detail step by step instruction showing you how to configure your project.
reference: http://help.github.com/mac-set-up-git/

Prepare Your RSA Public/Private Key for Your Workstation

  • go to your Mac machine, open terminal and enter the following to create your RSA key
ssh-keygen -t rsa -C "myemail@address.com"
  • enter the pass phase your like and make sure you can remember, you will need it later. Once this is done, you want to “cat” your public key so you can copy & paste to github
cat ~/.ssh/id_rsa.pub
  • copy the output starts from “ssh-rsa” and ends with your email address. copy the whole thing.
  • Now, go back to github website to add your Mac machine’s public key to your github account. go to Account Settings –> SSH Public Keys –> Add another public key.
  • enter the name you like, such as “My Macbook Pro” and then paste your public key in. Click on “add key” once this is done.
  • Now enter couple more commands on your Mac machine
git config --global user.name "Your Name"
git config --global user.email "youremail@address.com"

Now your Mac machine is configured and connected to your github account. You want to do these same steps to all your other development Mac machines. Next steep is to create a repository in your github account and start using it. Steps are coming up soon.

Join the discussion One Comment

Leave a Reply