No master branch when creating a repository?

I'm sorry if this is a dumb question, I have never used any type of version control before. I signed up for bitbucket, went through their tutorial with source tree to modify the file and push it back to the repository and had no issues

After creating a repository for some java code on bit bucket (repository is empty at this point), I went to source tree, located the directory where everything was stored, added it to the repository, added a gitignore file and did everything else I was told to do in a brief tutorial I found(including linking sourcetree to this repository).

In the tutorial, and everywhere else, it says I need to click "git flow" to push these files to bitbucket. However when I try, I get an error saying that "The production branch you chose, "master", does not exist." And then it tells me it can't create this branch.

After looking at my repository I see that there is no "master" under the branches, however, in my bookmarks, it says that I am working under the "master" branch. Also, when I tried to create a "master" branch, it won't let me. Does anyone know how to get around this or solve this issue?

9 answers

Just had the same issue and this was top on google with no answer. You need to add something and commit it. Once you do that the master branch will be created in your local repo and you can then push and branch from it. 

Thanks... it did worked !! 

Same problem here :(

Any help?

Thank you.

We really need a way to automatically create a master branch using the Bitbucket web page.  As it is, it is impossible to create a new repo and integrate it with SAP Web IDE as it expects/needs a branch to do the first commit.

I can't write up instructions for my team to install git and use the command line just to do this one step.

You have to initialize your repository with your username and name, after that your master branch will be created and you will be able to commit your code.

git config --global ""
git config --global "Your Name"



Yeah, that seems perfectly rational to continue to leave this out of the interface. 

so you cannot use the Bitbucket web interface to create this?  what sense does this make?  nor does it walk you through how to create it. 

Had the same issue after some merging mess.

Double-Click on Remotes-> origin -> master and check out the master branch again. For some reason, this hasn't been checked out (or was lost) out in my repo.



0 vote

you need to create the file then create the master branch

Try this:

1. Open terminal (button in SourceTree UI)

2. Type

git checkout -b master

 3. Close terminal

 4. Commit in your brand new master branch

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

27,060 views 26 12
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