Can't push local repo to private repo on bitbucket with Sourcetree Mac

Sourcetree and Bitbucket are making me lost my mind: I can't successfully push files to a Bitbucket repo using Sourcetree (but I'm successfully pushing/pulling from github, which is odd since it's  not made by atlassian).

I presume my problem is permissions based. I've attempted and failed repeatedly trying to set up and select clone on bitbucket, copy/paste address for SSH and HTTPS access to the repo into sourcetree.

SSH fails whether I place my SSH keys at the account level or at the repo level in Bitbucket (I have one key, it will only let me put it on the account or the repo, but not both; when I attempt to add it again it warns the keys are in use at the other level – makes no sense since the idea is to identify users thus only one set should be required, or either should work... they do on GIT, but not bitbucket).

HTTPS requires me to remove the keys to work at all, but when I do I get this odd message: "I don't handle protocol 'git clone https' "  I attempted typing the https string in manually, as I saw on Stack that the paste sticks a unicode character in there. No love.

C'mon, this can't possibly be so hard! It definitely isn't with git. I need a private repo, and am paying at github for what's theoretically free on bitbucket, but it doesn't work at all. Is this a case of "get what you pay for" or am I doing something wrong here? Apparently this is a common problem, which no one is inclined to answer:

Tried so far:

Instructions at:

Yields error: " Pushing to Permission denied (publickey).

fatal: Could not read from remote repository. "
But there are no public keys! So I presume this method relies on SSH.

What's the simplest way to push a local repo to Bitbucket using Sourcetree on a mac? I've followed every instruction and tutorial I've found to the letter. This seems impossible.

4 answers

I came across this issue too. I used SourceTree on my Mac to manage the SSH identities, and it didn't work. I solved it by following the solution here. Short summary:

From a terminal window:

> ssh-add -l

This will probably display "The agent has no identities.".

In which case, run the following at the terminal prompt:

> ssh-add

This will add your existing ssh RSA identity. If no keys were found, check the contents of the ~/.ssh directory to see of you have an file. If not, then run the following:

> ssh-keygen

and then run ssh-add again. Now, you need to copy the file contents to the clipboard:

> cat ~/.ssh/ | pbcopy

Next, tell BitBucket about it. Go to the settings of your BitBucket account. Under Security, choose SSH Keys and then add a SSH key. Give the new key a name (not so important), and paste in the key copied into the clipboard. It should start with "id_rsa". Save the key.

SourceTree should now work.

Help? Still an issue.

Same happening here. Bitbucket switched from usernames to email addresses and my dev process is totally broken. Refuse to go command line. Such a great job on the software til now but damn. This is NOT fun.

same issue here. I just get an error message with no response from the server which is : "Creation of the repo failed. the error which came from the server is:" 

I presume my problem is permissions based as well but not sure what to do from here. I can see all my remote repos in SourceTree and I'm able to clone them but creating one is like publishing not possible.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

699 views 5 10
Read article

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