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,558,393
Community Members
 
Community Events
184
Community Groups

Update Azure Repository with Bitbucket Repository.

Hi Everyone,

I have imported my Bitbucket Repository to Azure. Now, Is there a way to keep my Azure Repository updated with Bitbucket Repository?

Thanks

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 10, 2023 • edited

Hi @Osama Abdul Ghafoor,

If you make a clone of the Bitbucket Cloud repo on your machine with the --mirror option, you have a copy of the repo with all branches:

git clone --mirror <bitbucket_repo_url>

You can then navigate to the directory of the mirror clone and push to an empty Azure repo:

git push --mirror <azure_repo_url>

In order to update the mirrored repository in Azure, you can run the following commands in the directory of the mirror clone

git fetch -p origin
git push --mirror <azure_repo_url>

You could write a script that performs these operations (fetch and push) and schedule it to run periodically.


Another option is to use Bitbucket Pipelines to automate this process and run a pipelines build every time there is a push to the Bitbucket Cloud repo. You could use a bitbucket-pipelines.yml file similar to that one:

image: atlassian/default-image:4

pipelines:
default:
- step:
clone:
enabled: false
name: 'Mirror repository'
script:
- git clone --mirror ${BITBUCKET_GIT_SSH_ORIGIN}
- cd ${BITBUCKET_REPO_SLUG}.git
- git push --mirror <azure_repo_url>

Such a pipeline will run on every push to the repo, but you can also use a custom pipeline and schedule it to run at certain times/days.

You will need to set up authentication details to push to the Azure repo. You could use user-defined repository variables for any credentials if you want to use HTTPS. If you want to use SSH instead, you can set up SSH keys in Pipelines, and upload the public key to an Azure account that has write access to that Azure repo:

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events