Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,295,429
Community Members
 
Community Events
165
Community Groups

Empty repo handling with alternate initial branch names

I believe there is a small issue with the "You have an empty repository" screen displayed by BitBucket Server 7.9.0 which could cause later problems for situations where the repositories are not intended to use the default "master" branch name any more. If an empty repo is created by the Project administrator with a default branch name of "main", I believe the instructions that show on the page for "My code is ready to be pushed" should be slightly different. Specifically, the line "git init" on those instructions should be "git init -b main". Otherwise, git will create the new repo with the default branch name matching that user's locally configured default branch name (which still defaults to "master"). The line "git push -u origin HEAD:main" will workaround this in the short term by setting up so that whatever their local branch name ends up being, it will be linked to the correct branch name on BitBucket. However, it still sets up a situation where they have a local branch that does not match names with its associated BitBucket branch.

1 comment

After working with a developer with an older version of git installed, I realized that the git init -b option is relatively new (added in 2.28, was not present in 2.27). So instead my suggestion is to insert a "git branch -m main" command after the commit, but before the push. From my experiments, this works regardless of what the automatically generated branch name was, and git branch -m is supported as far back as I can find documentation for

Comment

Log in or Sign up to comment
TAGS
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,167 views 2 9
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you