Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,556,028
Community Members
 
Community Events
184
Community Groups

How can I push to a new repository from within bitbucket pipelines

mateusz_maly_external
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Mar 21, 2023

Hi,

I have a pipeline setup in which I create a brand new bitbucket repository and push some templates to it. Now I can get read access through the use of project and repository SSH keys. But I need to push code to the new repo so that does not work. How can I allow this one repo to have write access to other repositories within the workspace or projects?

This is a brand new repo I'm creating every time so ideally some workspace level access would be best. 

 

Thanks

2 answers

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Mar 22, 2023

Hi @mateusz_maly_external and welcome to the community!

I just wanted to add that there is one more option, other than the ones that Riley suggested: you could also use SSH.

  1. Open on Bitbucket Cloud website the page of the repo where you run these builds.
  2. Select Repository settings from the sidebar on the left
  3. Select SSH keys from the new sidebar on the left
  4. On this page, generate an SSH key pair
  5. Copy the public SSH key that is generated, and add it to the workspace's SSH keys (from the workspace's settings > SSH keys)

This way, your build will have write access to all the repos that belong to this workspace.

If you want to push to a newly created repo from your build this way, you will then need to use the SSH URL of this newly created repo. The format is as follows:

git@bitbucket.org:workspace-id/repo-slug.git

If you have any questions, please feel free to reach out!

Kind regards,
Theodora

0 votes
Riley Venable (Atlas Bench)
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Mar 21, 2023
To allow this new repository to have write access to other repositories within the workspace, you can use a Bitbucket Cloud Workspace Access Token with the following permissions: Repository Read (repository) and Repository Write (repository:write). You can create a Workspace Access Token with these permissions and include it in the URL, or provide it through an interactive prompt when using the Git CLI. You can also use OAuth by creating an account or bot account, giving that account write access in the branch permission to allow pushing directly to your main branch. Follow the steps listed above to create an OAuth consumer, record the keys, and add them as pipeline variables with the names CLIENT_ID and CLIENT_SECRET. Then, add the necessary script section to your bitbucket-pipelines.yml file.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events