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
Community Members
Community Events
Community Groups

Bitbucket Pipeline BRANCH_SLUG

I see there is no BRANCH_SLUG environment variable. How do we create one?

Use case: we use feature/ branch and need to publish that into a URL format. There's a slug for repo name, but not branch name.


2 answers

I got into the same issue today. While BITBUCKET_BRANCH variable exists, it does not fit to our needs because it may contain characters which are not compatible or may break your url. I like the idea how gitlab handles refs. There's no branch or tag, there's just reference, which may be either the branch name, or the tag name. And there's also REF_SLUG, which is webalized version of the ref name:

Lowercased, shortened to 63 bytes, and with everything except 0-9 and a-z replaced with -. No leading / trailing -. Use in URLs, host names and domain names.

I know we can make this variable possible with usage of bash tools, but could be good to have ootb and same for all projects.




0 votes
davina Atlassian Team Nov 01, 2017

Hi Philip,

We have the 


environment variable.

Is this not what you want?

See Lukas's reply below. No, it does not work. It doesn't clean the branch name, e.g. "feature/my-branch-#ticket"

Like Pavel likes this

Come on, 3 years gone, and still no so needed variable?

4 years gone and still not there... even though repo_slug exists.... @davina any news on this?

Suggest an answer

Log in or Sign up to answer
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,111 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