Using XCode 4 with GitHub

Git is a distributed source control system (like subversion) – still not sure what it is and if you need it? Take a look at this crash course.

GitHub is a web-based hosting service for software development projects that use the Git revision control system. GitHub offers both commercial plans and free accounts for open source projects.

This is how we set up Xcode 4 and GitHub to work together on the Mac for a new iOS (iPhone or iPad) project. We’re assuming Mac OS Version 10.6.8, Xcode version 4.02 and the latest version of Git.

  1. Register as a new user with GitHub. You can host public open source projects on GitHub for free – if you need private projects you will have to sign up for a paid plan.
  2. Follow GitHub set up steps 1 & 2.
  3. Create your new project in Xcode – check ‘create local git repository for this project’ within the wizard when asked.
  4. Create a README file and add it to the main directory of your Xcode 4 project.
  5. On GitHub create a new repository with the same name as your Xcode project (it doesn’t have to be same name but keeps things simpler).
  6. After creating the new repository (or ‘repo’) on GitHub – follow the ‘Existing Git Repo?’ directions on GitHub.
  7. Now as you make changes in your Xcode source code or project – you can commit them with the standard Xcode command – File -> Source Control -> Commit.
  8. After committing your changes you can push them to your remote repository on GitHub from the command line (from your Xcode project directory) using ‘git push -u origin master’.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s