Created
May 29, 2020 07:54
-
-
Save nioq/5ada9a4def86fee89abd41fa4b1e3f3b to your computer and use it in GitHub Desktop.
Generate a CSV list of all Bitbucket repositories you have access to. From https://github.com/Tinkertanker/bitbucket-github-migration
This file contains hidden or 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
#!/bin/bash | |
read -p 'Bitbucket Username (not email): ' BB_USERNAME | |
read -sp 'Bitbucket Password: ' BB_PASSWORD | |
next_url="https://api.bitbucket.org/2.0/repositories?role=member" | |
while [ ! -z "$next_url" ]; do | |
response_json=$( curl -s --user $BB_USERNAME:$BB_PASSWORD "$next_url" ) | |
echo "$response_json" | jq -r '.values | map([.slug, .workspace.slug, .description, .is_private] | @csv) | join("\n")' | |
next_url=$( echo "$response_json" | jq -r '.next' ) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment