Putting Your Xcode Project on GitHub, Bitbucket, or GitLab

GitHub, Bitbucket, and GitLab simplify working on projects with other people. These sites also provide online backup for your projects in case your computer is damaged or stolen. Starting with Xcode 10 (Xcode 9 for GitHub) you can put your Xcode projects on GitHub, BitBucket, or GitLab without leaving Xcode. This article shows you how.


You must have an account on GitHub, Bitbucket, or GitLab. Xcode can’t create an online account for you. If you don’t have an account, go to the site you want to use and create an account. GitHub is the most popular place to host projects online, but Bitbucket and GitLab are also fine to use.

Your Xcode project must be under version control. The easiest way to place your project under version control is to select the checkbox to create a git repository when you create the project.


If you have an existing Xcode project that is not under version control, choose Source Control > New Git Repository in Xcode to create a git repository for the project.

Adding Your Account to Xcode

Adding your GitHub, Bitbucket, or GitLab account to Xcode isn’t mandatory, but doing so makes things a little easier when you put your project online. Open Xcode’s Account preferences by choosing Xcode > Preferences and clicking the Accounts button in the preference window’s toolbar.


Click the Add button to add an account.


Choose GitHub to add a GitHub account, Bitbucket Cloud to add a Bitbucket account, and GitLab.com to add a GitLab account. Xcode will ask you for your username and password.


GitHub requires you to create a personal access token and use that instead of a password for authentication.

Putting the Project Online

You’re going to use Xcode’s source control navigator to put the project online. Open the source control navigator by choosing View > Navigators > Show Source Control Navigator or by pressing Cmd–2.


Newer versions of Xcode have Changes and Repositories buttons at the top of the source control navigator. Click the Repositories button to show the branches in the git repository.

Creating a remote branch is how you put your project online. Select the Remotes folder, control-click, and choose Create Remote. A sheet like the following will open:


Choose your account from the Account menu. If you did not add your account to Xcode, choose Add an account to add your account. Choosing an account will set the Owner menu to the username for your account.

Xcode sets the repository name to the name of the project for you, but you can change it if you want. Xcode has problems with uppercase letters in Bitbucket repository names. Use all lowercase letters if you’re using Bitbucket. If you would like to enter a more detailed description of the project, use the Description text view.

Choose the visibility for your project online: private or public.

The remote name is initially set to origin. If you want a different name, enter it in the text field. The most common reason to change the name is hosting your project on multiple sites. Suppose you want to host your project on both GitHub and Bitbucket. To avoid confusion it would make sense to name the GitHub remote github and the Bitbucket remote bitbucket.

Click the Create button to create the remote branch and place your Xcode project online.

Where to Go from Here?

Now that your Xcode project is online, you’ll have the option to push your changes online every time you commit.

Work on your Xcode project in a local branch. Push your changes to move them to the remote branch on GitHub, Bitbucket, or GitLab.

If you want other people to work on your project with you, they can clone your project by choosing Source Control > Clone in Xcode.

Want to Learn More About Git?

Check out my version control book. It shows you how to do the most common git tasks without leaving Xcode. Some of the material covered in the book includes cloning projects from GitHub, branching, and going back to earlier versions of your project.