#!/bin/bash
#Script to get all repositories under a user from bitbucket
#Usage: get_all_bitbucket_repos.sh [repo_owner_username] [username] [password]
curl https://${2}:${3}@api.bitbucket.org/1.0/users/${1} > repoinfo
for repo_name in `cat repoinfo | grep -o "\"name\": \"[^\"]*" | grep -o "[^\"]*$"`
do
git clone https://${2}:${3}@bitbucket.org/${1}/$repo_name.git
done