Created
June 12, 2019 14:09
-
-
Save XayOn/f9a6872591489197e72aeed33db51e00 to your computer and use it in GitHub Desktop.
Clone all bitbucket repositories using ssh for a specific organization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage $0: <org_name> <user> <password> | |
shopt -s lastpipe; set +m; | |
print_elements(){ | |
curr=$(http get $1 -a "$2:$3") | |
jq -r '.values[].links.clone[] | select(.name == "ssh")|.href' <<< $curr | |
jq -r .next <<< $curr|read next_url | |
[[ $next_url != "null" ]] && print_elements $next_url $2 $3 | |
} | |
while read repo; do git clone $repo; done < <(print_elements "https://api.bitbucket.org/2.0/repositories/$3/" $1 $2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment