How To Use Source Tree To Manage Bitbucket Repository In Mac OS And Windows

Bitbucket is a web site which is owned by atlassian company. It provide free private git repository service, your source code will not be exposed to public when saved in their repository. It also provide a bitbucket server for you when you want to install the repository server on your own machine, but bitbucket server software need some fees.

Source tree is a free git client tool which is provided by bitbucket. It support both Mac and Windows. If you want to use git tool for Linux, you can read article How To Use SmartGit In Ubuntu. This article will tell you how to setup git respository in bitbucket website and how to use source tree to manage it.

1. How To Create Repository In Bitbucket.

  1. First you should register a bitbucket account, or you can use google account to login to bitbucket.
    bitbucket login page
  2. After you login, click Create ( + ) button in left panel list.
    bitbucket create button
  3. Then click Repository menu item in the popup menu list.
    create bitbucket repository menu item
  4. Now it will popup Create a new repository window, input the repository name, check This is a private repository checkbox in Access level section. Select your Version control system as Git or Mercurial, i select Git radio button. Click Advanced settings link to expand advanced settings area. Select the repository used language from the Language drop down list.
    create new repository window in bitbucket
  5. Then click Create repository button to create it, after that you will see the new repository dashboard like below.
    bitbucket new repository dashboard

2. Install & Setup Source Tree.

  1. Download and install source tree for mac or windows. This step is very straight forward.
  2. When you run the source tree tool for the first time, it will show you the popup registration dialog window. The Bitbucket Cloud option will let you connect your source tree client to the bitbucket repository that you just created in bitbucket website. The Bitbucket Server option will let you connect source tree client to you own bitbucket server.
    source tree registration popup window
  3. Click the Bitbucket Cloud button, it will open a web browser to display bitbucket login page. You can login to it with either your own bitbucket account or google account.
    bitbucket login page
  4. After you login successfully, you will see below Registration complete! dialog, click Continue button.
    source tree first time registration complete success
  5. Then it will jump to Preferences dialog, just click Done button in it.
  6. After some while, it will open a window which list all your repositories created in bitbucket website.
    source tree list all bitbucket repositories
  7. You can click the Clone button to clone and download the repository data to your local machine directory. When you click the Clone link at the end of each line, it will popup below dialog. The Source URL value should not be changed, you can select different Destination Path in your local machine. Then click Clone button to start clone.
    clone repository dialog in source tree
  8. When the clone process complete, you will see source tree’s main window like below. If you create a new file such as hello in local folder /Users/songzhao/testrepository, this folder is also the repository managed local root folder, then you can see there is a commit ready in source tree main window.
    a new file is ready to commit in source tree
  9. Click Commit button at top left corner, input commit description and check Push changes immediatlely to origin/master checkbox, then click Commit button to commit the changes to remote bitbucket repository server.
    input commit description and commit to remote repository immediately
  10. When the commit process complete and success, it will show Completed successfully in the popup commiting dialog, otherwise it will show you the error messages in that popup dialog to tell why the commit fail.
READ :   How To Resolve Git Push, Pull, Merge Conflicts In Bitbucket Use SourceTree

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.