How can I stop the ".git" folder being deleted from shared artifact?

I have a build plan setup like the following:

1. Checkout Stage - Spits out a shared artifact containing everything "**/*"

2. Build Stage - Spits out a shared artifact containing everything from 1 plus compiled binaries "**/*"

3. Release Stage - Merges changes to a release branch and does a push

The problem that I am having is that the ".git" folder is not being included in the shared artifacts which then makes stage 3 impossible. It looks like bamboo is using ant to create the artifacts which by default has a list of excludes (.git being one of them). How can I stop this occuring? Is there any way that I can override the default excludes?

2 answers

0 votes

The easiest way would be to change your artifact to point to a zip file created in a Script Task.

If your Release Stage is not optional, be sure to have a look at the features coming in Bamboo 4, which include automated merges with relase branches.

I ended up temporarily renaming it to _git but turns out it's not that simple... The "remote" wasn't what I was expecting but rather a local cache location. It's in the too hard basket for now which is a massive shame. I'm sure that I'm not the first person wanting to do this.

Hm... but what exactly are you trying to achieve? To be able to make the Bamboo commit some changes (merge) and push it back to the upstream repo?

Why do you need three stages?

Why do you need to pass the source code as artifact (between stages 1->2->3)? Why not check the code on each stage (this would make the stage 1 not necessary any more)? Otherwise why not combine all the three stages into one Bamboo Job containing multiple Bamboo Tasks?

I'm thinking that your problem you want to solve is not passing the .git folder around the stages, but rather how to merge back changes into the repository - that's why I'm asking these questions, to better understand the situation and give better response.

It was done in stages to allow both Debug and Release builds to happen in parallel in the Build Stage, after having pulled down the source once in the Checkout Stage. Regardless though, the push problem remains. Even if all done sequentially in one stage, I still can't easily push a branch or tag because the remote location is a local cache and not the location specified in the build plan as I had expected.

How do you push? By using script task containing something like

git push


How about using explicit

git push ssh:// aBranch


Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday 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...

199 views 4 1
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