How do I configure Git in Xcode to work with BitBucket How do I configure Git in Xcode to work with BitBucket git git

How do I configure Git in Xcode to work with BitBucket


I've met the same problem and here's how I solved it:

  1. (Assume your project is not already under local source control) Create a new project under LOCAL source control (Please note that adding remote source control at this stage may not be successful)

  2. Make this new project a clone of your old project - drag files, add frameworks, etc.

  3. In menu "Source Control" -> -> "Configure "In the new window, click on "Remotes" -> "+" -> "Add Remote"

  4. "Source Control" -> "Commit"

  5. Select "push to remote" at the left bottom corner

  6. Click "Commit"

  7. Check on BitBucket website to see if it's actually pushed to it


As of 2017, xCode now automatically creates repositories for new projects. To push to a new BitBucket repo, go to 'Source Control' > 'Commit...' in xCode and make your first local commit.

Next open a terminal and navigate to to the top-level directory of your project. If you ls -a in here you should see the .git/ directory has been created. In the same directory, add your remote repo with the following (replace with your username/team name and repo name):

git remote add origin https://USERNAME@bitbucket.org/USERNAME/REPO_NAME.git

Go back into xCode, go to 'Source Control' > 'Push...'. You'll be prompted to enter your BitBucket password. Press OK and you're done! Source control commands will now be working within xCode.


I did that through command line and it is fairly straightforward.

  1. create a new repo on bitbucket
  2. assuming your xcode project is not under local git version control yet
  3. go to command line, cd to your xcode project directory, and the follow the bitbucket doc: https://confluence.atlassian.com/display/BITBUCKET/Import+code+from+an+existing+project

    git initgit remote add origin git@bitbucket.org:<user_id>/<repo>.gitgit add .git commit -am 'init commit'git push -u origin master
  4. go back to xcode and you should be able to interact with bitbucket through xcode from this point on