Friday, May 31, 2019

Add Remote Repository to Xcode Project

I have been using BitBucket web based repository for a while. I like its user interface, easy and convenient to view changes of my Xcode projects. Another nice thing about this service is that BitBucket allows to create private repositories and it is free.

To add a project to git repository, exit Xcode and open a Terminal.

Local Git Repository

For creating a local git repository, please read my previous blog. This step is important because the remote git repository is based on local git repository.

Remote Git Repository

Create a new repository on BitBucket first, for example, myTestPository. Use the following command in Terminal to link local repository to remote.

# Sets to new remote
git remote add origin remote
# Verifies the new remote URL
git remote -v
# Pushes the changes in your local repository up to the remote repository you specified as the origin
$ git push -u origin master

With the above steps completion, your remote git repository is ready for committing any new changes/updates.