bamboo.repository.git.branch variable not pointing to branch


I'm automating the build of an android application with bamboo and I have trouble archiving the resulting .apk-files in a webserver directory.

The code is hosted in a bitbucket git repository with multiple branches which bamboo recognizes and builds different apks for each branch.

Once the build is complete the apk file should be copied to a webserver directory, so I added a script task with the following content:


mkdir -p $dir

cp bin/appname.apk $dir/appname_b${bamboo.buildNumber}.apk

The result for build 45 in the branch "foo" should be a file in


The problem is, that the file is copied to the same folder for all branches:


i.e. the variable pointing to the branch is always master and I would assume it should be foo in this case?

I stripped my configuration to the minimum:

  • One Stage
  • One Job
  • One Task: Source Code Checkout from the default repository
  • One Task: Script which just prints the variable to the logfile (with the same result)



4 answers

1 accepted

0 votes
Accepted answer

The answer is:

a) Don't use bamboo.repository.git if you are using bitbucket

b) use if you are using version 4.4.5

Hi Kai,

Can you tell something more about your setup? I'm particularly interested in:
* your plan->configuration->repository configuration (how is your 'default' repository configured - can you for example attach screenshot here of that configuration?)
* how is your plan-branch configured - can you tell me if you're using some Bamboo built-in 'merging' strategy like Gatekeeper or Updater?
* how is repository override configured in your plan-branch (foo)? (branch->configuration->repository settings) - can you attach a screenshot here?

I think that {bamboo.repository.git.branch} should work for your case, but I'm worried that some corner-case kicks in and overrides the branch name with the plan's default repository settings. Above informations could shed some light on that hyphothesis. Oh, and BTW: which Bamboo version are you running?



thanks for the reply.

I checked all the information and realized it was due to me not using git directly, but via bitbuchet which apparently does not set the git-variables although it's using git ;-)

However I found which is working in my 4.4.5 version so sorry for your time ;-)



No problem. Glad to hear that you've resolved the issue. :)

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Jan 15, 2019 in Statuspage

Introducing Statuspage Getting Started guides! First up: What is Statuspage?

Over the next several weeks we'll be sharing some of our Getting Started guides here in the community. Throughout this series of posts, we'd love to hear from customers and non-customers ab...

265 views 4 2
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