Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to exclude files when deploying to s3 with the aws-s3-deploy pipeline?

I've been trying the aws-s3-deploy pipeline (, with little success.

My goal is to exclude the .git folder from deployment. According to the pipelin documentation, I set the var

    EXTRA_ARGS: "--exclude '.git/*'"

The pipeline runs correctly, but the .git folder is always uploaded to S3. If I use double quotes, it is also uploaded. If I remove the quotes, an error happens (because the shell tries to expand).

Whenever I don't use quotes, and I don't use wildcards, for example

    EXTRA_ARGS: "--exclude"

everything works as expected and the file is excluded. So the problem seems to be whenever I want to use wildcards.

Any ideas on how to exclude the .git folder from deployment?

3 answers

1 accepted

3 votes
Answer accepted

Could you try this:

EXTRA_ARGS: '--exclude=.git/*'

We're currently looking at whether we can improve the way pipes handle parameters that contain special characters like * or " but for now I think this might work.

Excellent! It works, thanks.

Like Steven Vaccarella likes this

For me works too. Thanks!

Hi @Rodrigo Serrano ,

How about using:

EXTRA_ARGS: '--exclude=".git/*"'

No, exchanging single for double quotes (or the opposite) does not work. This is the log from the pipeline console:


( ... )
Status: Downloaded newer image for bitbucketpipelines/aws-s3-deploy:0.2.2
INFO: Starting deployment to S3...
aws s3 sync . s3://<my-bucket-here>/ --cache-control=max-age=3600 --delete --exclude --exclude ".git/*"
Completed 23 Bytes/~2.2 MiB (122 Bytes/s) with ~88 file(s) remaining (calculating...)
upload: .git/HEAD to s3://<my-bucket-here>/.git/HEAD
(... etc ...)

Like dam0 likes this
mwatson Atlassian Team Mar 13, 2019

I haven't tried it, but .git has directories in it, so wouldn't you have to also exclude .git/*/* and maybe even .git/*/*/* - which sort of doesn't make sense. Have you tried just `--exclude .git`?

EXTRA_ARGS: '--exclude=".git/*"' - formats correctly to the command line. If copied & run from the terminal it works, but not within the pipe...

tried few combinations to ignore multiple files and folders and this works for me.

EXTRA_ARGS: '--exclude=.git/* --exclude .gitignore --exclude bitbucket-pipelines.yml --exclude'

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

⭐ Calling all Bitbucket and DevOps experts: Special showcase opportunity ⭐

Hi, Bitbucket community! Are you a DevOps practitioner (or know one in your network)? Do you have DevOps tips, tricks, or learnings you'd like to share with the community? If so, we'd love to hea...

1,527 views 4 8
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