There is not an out of box feature in azure repository to sync with bitbucket repo.
However, you can achieve this via azure pipeline. See below steps:
1, create an azure pipeline (eg.classic UI pipeline). For detailed steps check out this tutorial.
2, Add a script task in your pipeline to run git commands.
- To sync bitbucket with Azure repo code commit.
- powershell: |
git config --global user.email "you@example.com"
git config --global user.name "bitbuckt username"
git push https://username:password@bitbucket.org/name/repo.git HEAD:$(Build.SourceBranchName) -q
#if your password or username contain @ replace it with %40
- To sync Azure repo with bitbucket code commit.
- powershell: |
git config --global user.email "you@example.com"
git config --global user.name "azure account name"
git clone https://username:password@bitbucket.org/name/repo.git
cd repo
git push https://$(System.AccessToken)@dev.azure.com/organ/proj/_git/repo HEAD:$(Build.SourceBranchName) -q
You can enable Enable continuous integration
for the azure pipeline. So that every time when there is a code commit in azure repo. The pipeline will be triggered, and the code will be synced to bitbucket repo.
