Creating an Xcode Project to Work with GitHub or Bitbucket

September 30th, 2015

Filed under: Version Control, Xcode | Be the first to comment!

GitHub and Bitbucket are two of the most popular sites for storing git repositories online. In this article you’ll learn how to create an Xcode project and have it hosted on GitHub or Bitbucket.

NOTE

It may sound obvious, but you must first sign up for an account on GitHub or Bitbucket.

Hosting an Xcode project on GitHub or Bitbucket sounds difficult, but it’s really not. Perform the following steps to host a new Xcode project on GitHub or Bitbucket:

  1. Create a new Xcode project by choosing File > New > Project in Xcode.
  2. When choosing a location to save the project, select the Create git repository checkbox to create a local git repository for your project on your Mac.
  3. Login to GitHub or Bitbucket.
  4. Create a new repository.
  5. When you create a new repository, GitHub and Bitbucket provide instructions on how to push an existing repository to your newly created repository. This involves running two git commands: git remote add and git push.
  6. Launch the Terminal application on your Mac.
  7. Navigate to your Xcode project’s directory.
  8. Run the two git commands. You can copy and paste them from GitHub or Bitbucket.

The git remote add command makes your newly created GitHub or Bitbucket repository a remote branch of the local repository on your Mac. The git push command pushes the files under version control from your local repository to the remote repository hosted on GitHub or Bitbucket.

Now you can push changes to GitHub or Bitbucket from Xcode by choosing Source Control > Push.

Tags: ,


Leave a Reply

Your email address will not be published. Required fields are marked *