How can I mirror repositories to other repositories

  • Page Owner: Not Set
  • Last Reviewed: 2020-11-10

When a client wants to host their own repository but we want to continue following blends processes and other developers don’t have access to clients repository, how can we keep them in sync on Azure Devops.


Answer

What i have found is to setup and azure pipeline that response to all branches or just a single branch that automatically kicks off the pipeline to start the repository sync.

In the pipeline, you select the repository you want to sync. Then as your pipeline step, you add a “Git Mirror” Task to the pipeline. There is 1 parameter that you will need to specify and that is the remote git repo that you want to repo to sync with. You will need to create a personal access token on the remote repository to allow it to modify the remote repo. So in our case we just append the PAT(Personal Access Token) to the remote repo url and will will trigger based on your tirgger for the pipeline.
The url is as follows for the parameter
https://$(PAT)@remoterepourl.git