Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

No master branch when creating a repository?

Alex Scott May 31, 2014

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?

11 answers

15 votes
RakeMark June 14, 2015

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. 

Joy Progga October 6, 2017

Thanks... it did worked !! 

6 votes
Denis Lomtev July 18, 2018

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

Brian Geary February 13, 2020

This worked for me - thanks for sharing the tip!

4 votes
Peter Roehlen March 9, 2016

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.

1 vote
danielrolonbenitez July 10, 2018

you need to create the readme.md file then create the master branch

ChipReap April 9, 2019

That only works if you want a readme file in your repository

1 vote
Bradley Harrison May 17, 2016

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. 

1 vote
Mohit Khandelwal May 11, 2016

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 user.email "your@email.com"
git config --global user.name "Your Name"

 

 

William T Campbell July 5, 2016

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

Like # people like this
jmonkfish April 27, 2020

(Hope Atlassian knows he's being sarcastic).

1 vote
Rodrigo Moreira August 1, 2014

Same problem here :(

http://screencast.com/t/c1fDVIb3n

Any help?

Thank you.

0 votes
Adrian Cervantes February 5, 2020

in cd proyect - git init 

git add .

git commit -m "initial"

git push -u origin master

 

that works for me!

0 votes
ajkarikari_knowit January 21, 2020

Try this if none else works and lets say that you'r using VS code.

Once you've created your repository on bitbucket, clone it to your local workstation and open VS code and set it to the local folder of your rep.

Open the terminal and run

git push -u origin master

Your terminal should write:

 * [new branch] master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.

This should be it. 

0 votes
Dennis Löhmann January 19, 2017

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 votes
Norman Abramovitz
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 31, 2014

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events