Thursday, 4 April 2019

Azure DevOps - Cloning and updating all Git repositories

If you have a lot of repositories in your Azure DevOps team, you need an easy way to clone and/or update your local Git repositories.

You first need to install the Az-cli available at: https://docs.microsoft.com/cli/azure/install-azure-cli

Once installed, please run the following in a console:
az extension add --name azure-devops

You also need to login, just once. Run the following in a console:
az login

Create the following files:


Replace C:\YourWorkFolder with the root folder of all your repos.
Replace XXXXXXXXXX with the name of your organisation and project.

For example:
az devops configure --defaults project=TestProject
az devops configure --defaults organization=https://dev.azure.com/TestCompany/


Run the sync.cmd file, and that is it. It will clone new repos if you don't already have them, and will update your repos if you already have some.