If you do choose to use SourceTree as a GUI Git client, you'll need to add your BitBucket credentials to SourceTree. Let's do that now.
- Open the SourceTree app.
- Click the "Gear" icon in the top right corner and select "Settings"
- Click "Add Account"
- Hub: Select "BitBucket"
- Username: (Enter your BitBucket username)
- Password: (Enter your BitBucket password)
- Protocol: Select "SSH"
- Click "OK"
- If you are on a Mac, you might be asked if you would like to store your information in your keychain. You can make that decision for yourself. I'll click "Always Allow".
Once you've done that, you'll see your BitBucket repo and can click "Clone" to clone it to your local machine. I'll clone it to a new location on my local machine just to show how it works, and then I'll just add the copy that I already have to SourceTree.
Cloning a Repo to Your Local Machine
- Click the "Clone" link next to the repo you'd like to clone
- Source URL: (Leave this at its default. If you change it the clone won't work.)
- Destination Path: (This is the location on your computer that you'd like the repo to be cloned to.)
- Name: (This is the name of the bookmark that represents the repo in SourceTree)
- Click "Clone"
The repo will be cloned to your local machine and should open in a new window when it's done. If it doesn't, double click on the bookmark in the list in the "Local" tab.
Deleting a Repo from SourceTree
Since I already have this repo on my machine in another location, I'll delete the copy that I just cloned.
- Right click on the bookmark
- Select "Delete" (When you do that, you'll be asked whether you'd just like to remove the bookmark from SourceTree and leave the repo on your machine, or also move the repo to the Trash. Since I already have this repo in another location, I'll move it to the trash.)
- Click "Also Move To Trash"
Adding an Existing Repo that Has a Corresponding Remote to SourceTree
For some reason if you click "Clone" next to a repo you already have on your local machine and select the existing directory, it won't connect the remote repo with your existing copy. You can either clone it to a new location, or add the directory manually in the Local tab. I'll add my existing project manually.
- Click "New Repository"
- Click "Add existing local repository"
- Navigate to your repo
- Click Open
Once that's done, you can double click the new bookmark and use SourceTree as you normally would. To verify that it is connected to the remote on BitBucket, click the "Settings" gear in the top right-hand corner and you should see the BitBucket remote in the "Remotes" section.