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

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
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
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,577 views 0 6
Read article

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