Pipelines: Authentication failed for 'https://x-token-auth:{access_token}@bitbucket.org/.../'

In my Bitbucket Pipelines build, I want to delete a branch using

git push origin --delete $BITBUCKET_BRANCH

But then I get the following error:

Pipelines: Authentication failed for 'https://x-token-auth:{access_token}@bitbucket.org/.../'

How can I set up my Pipelines build so that it can push to origin?

I assume one could generate an SSH key, put that inside the docker image (or inside the repo, encrypted) and add that to a Bitbucket account. However, I guess there may be an easier way you guys had in mind for this scenario.

3 answers

This widget could not be displayed.

Hi Jens, did you ever figure this out? I'm experiencing this same thing...

This widget could not be displayed.

Unfortunately not. I suspect one could do something with OAuth tokens, but I can't seem to find information for this exact use case.

This widget could not be displayed.

Add this to your pipelines - git remote set-url origin https://{bitbucket_username}:{bitbucket_password}@bitbucket.org/../

If you do this you would want to make sure your bitbucket_username and bitbucket_password are in environment variables that are marked as secure in your link like so.

https://$BITBUCKET_USERNAME:$BITBUCKET_PASSWORD@bitbucket.org/../

and then add BITBUCKET_USERNAME and BITBUCKET_PASSWORD as environment variables in your repo's or the account that own's the repo's settings under Environment variables. When setting these environment variables you can select them to be secure by checking a check box. This will prevent someone from seeing them as output in the pipeline's log.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Friday in Bitbucket

What is your #1 piece of advice to new users getting started using Bitbucket?

Hello Community! My name is Claire Maynard, and I’m a Product Marketing Manager on the Bitbucket team. I’m interested in hearing what advice or tips you have for new users getting started on ...

186 views 12 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