Skip to content

Instantly share code, notes, and snippets.

@anuragdhingra
Created May 18, 2020 10:43
Show Gist options
  • Save anuragdhingra/fd506fea00a2c64bd3954cc07305dce6 to your computer and use it in GitHub Desktop.
Save anuragdhingra/fd506fea00a2c64bd3954cc07305dce6 to your computer and use it in GitHub Desktop.
Clone all your azure DevOps repositories in your organization at once using Azure CLI.
  1. Install Azure CLI
brew install azure-cli
  1. Add the DevOps CLI extension -
az extension add --name azure-devops
  1. Set your default organization and project -
az devops configure --defaults organization=https://dev.azure.com/myorg project=myproject
  1. Clone, all at once -
az repos list | jq -r '.[].webUrl' | while read webUrl ; do git clone "${webUrl}" ; done
@gerardoepitacio
Copy link

gerardoepitacio commented Jun 1, 2022

@pradeepradyumna you need to have installed "jq" package.

  1. install brew https://brew.sh/
  2. install jq once brew is installed $brew install jq
  3. once jq is installed you can run $az repos list | jq -r '.[].webUrl' | while read webUrl ; do git clone "${webUrl}" ; done

@CDixon0416
Copy link

If you have ssh keys set up you can alternatively use az repos list | jq -r '.[].sshUrl' | while read sshUrl ; do git clone "${sshUrl}" ; done I found this easier so I didn't have to keep authenticating for each project.

@MatteoOreficeIT
Copy link

MatteoOreficeIT commented Mar 16, 2023

@zenatuz
Copy link

zenatuz commented Oct 30, 2023

Clone with ssh:

az repos list | jq -r '.[].sshUrl' | while read sshUrl ; do git clone "${sshUrl}" ; done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment