Git on BitBucket

Jakob Jenkov
Last update: 2015-01-20

BitBucket.org is a repository hosting service. You can host your Git or Mercurial repositories on BitBucket. Hosting Git repositories on BitBucket is free when you have less than 5 users accessing it, regardless of whether the repository is public or private.

Create a BitBucket Account

Before you can create any Git repositories on BitBucket you must first create an account on BitBucket. To create a BitBucket account, just go to:

https://bitbucket.org

Follow the signup process there.

Create a Git repository on BitBucket

Login to your BitBucket account and follow the instructions on how to create a new Git repository. It is pretty easy. Their user interface guides you all the way. Look out for the "Create" button in the menu bar at the top of the user interface.

Clone the Git Repository

Once you have created your Git repository, you can clone that Git repository in SourceTree. Cloning a Git repository hosted on BitBucket with SourceTree is very simple. Once you select the given repository in your repository list, BitBucket shows a button with the text "Clone in SourceTree". Click that button and follow the instructions on your screen. SourceTree will open on your computer (if you have it installed) and guide you through cloning the Git repository.

If you have not downloaded and installed Atlassian SourceTree (Atlassian's GUI for Git), BitBucket's user interface can guide you to how you get that done.

Push to BitBucket

Once you have cloned the Git repository from BitBucket on your own disk, you will have a local copy of your BitBucket Git repository.

You can now add files to your local repository workspace, commit them to the local copy of the Git repository, just like I have described in the Git tutorial introduction.

When you are ready, you can "push" the changes to the remote (original) Git repository on BitBucket.org. Atlassian SourceTree has a big "Push" button at the top of the GUI. This button is used to push local commits to the remote (original) repository on BitBucket (or whereever else the original/remote repository is stored). Just click the "Push" button and follow the instructions.

Other users with access to the same Git repository on BitBucket can now "pull" down your changes, and they can also "push" commits up to the Git repository on BitBucket. This way you can all get the latest version of all files in the whole project.

Jakob Jenkov

Featured Videos

Java Generics

Java ForkJoinPool

P2P Networks Introduction



















Close TOC
All Tutorial Trails
All Trails
Table of contents (TOC) for this tutorial trail
Trail TOC
Table of contents (TOC) for this tutorial
Page TOC
Previous tutorial in this tutorial trail
Previous
Next tutorial in this tutorial trail
Next