0

I am moving my code repository from bitbucket to Azure repository. The issue I am facing is that I can set up hook in bitbucket that would mirror the repository to AWS code commit. However, I could not find such functionality in Azure repository

Is there any way to do that?

Regards

Xavier
  • 389
  • 7
  • 20
  • this is how to sync with GitHub: https://stackoverflow.com/questions/36814023/how-to-synchronize-vsts-and-github-respositories-when-commits-are-made – Shayki Abramczyk Jun 30 '20 at 08:38

1 Answers1

2

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.

enter image description here

Levi Lu-MSFT
  • 27,483
  • 2
  • 31
  • 43