How to clone and push a Git repo upstream using SourceTree?

Hi, folks,

Git, Atlassian, etc., newbie here. Have a "working" Git repo on my Win7 PC (actually a Parallels VM running on my Macbook Pro :-) which I created and to which I have been adding commits using the SourceTree app. So far, so good. But how do I:

  1. Clone it to the "cloud", i.e., copy to Bitbucket?
  2. Make the appropriate settings and linkages so that the Bitbucket clone is the "Master" and, when I commit further changes locally on my PC, I can "push" them manually or automatically to the Master?
  3. How do I share access to the Master, so that I can allow another Atlassian account holder to create a clone on their local machine, and push/pull changes? (I imagine that this item is "standard" enough that you can just point me at a section of the docs or tutorials for how to accomplish it.)

Asking for help here because I found the following items confusing (and you can take their clarification as desired enhancements to the product.)

  1. The online tutorials for command line Git operations and usage scenarios were useful, but didn't find any written in terms of SourceTree and it wasn't obvious in some cases how to directly connect one with the other.
  2. I'm not very clear on how Atlassian accounts and your various products relate to one another, and how they interoperate. Is there an overview document that describes this?
  3. Have some questions on holding multiple accounts. I'm sending this question while logged into my "personal" account (i.e., with my personal email address in my profile). I also should have a commercial account (i.e., with another email address and domain name, part of the Atlassian account for that domain holder). But my second (commercial) email address isn't recognized by Atlassian, even in the "Forgot my password" procedure. Maybe I'm confusing the two. (Will try to sort this out with the commercial account holder.)

Thanks for any enlightenment :-)


2 answers

That is a lot of questions seeking a lot of different answers. I am addressing the first 2 in your first set of 3, which boils down to: "How do I get my existing repository into the cloud and linked with SourceTree?"

1. Create a new repository in BitBucket.

2. Click the link to "I have an existing project to push up". That link will give you these commands to run locally (will include your specific remote url):

cd /path/to/my/repo
git remote add origin
git push -u origin --all # pushes up the repo and its refs for the first time
git push -u origin --tags # pushes up any tags

Once you have a bitbucket repository, there is a prominent option on the repo dashboard to invite other users.

Suggest an answer

Log in or Join to answer
Community showcase
Maarten Cautreels
Posted Thursday in Off-topic

Friday Fun: What's your favourite beer/drink

As a Belgian, beer-lover and home brewer, beer is one of my great passions. I love the fact that with just a few ingredients (usually just water, hop and malt) you can create so many different tastes...

285 views 38 9
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot