Skip to content

Instantly share code, notes, and snippets.

@scottopell
Created August 25, 2016 21:54
Show Gist options
  • Save scottopell/b9f4a60d0a49fc90c62cd0b3abb2f56e to your computer and use it in GitHub Desktop.
Save scottopell/b9f4a60d0a49fc90c62cd0b3abb2f56e to your computer and use it in GitHub Desktop.
Clone all user's repos on bitbucket
#!/bin/bash
# Script to clone all repositories under a user from bitbucket
# Usage: getAllRepos.sh [username]
repos=$(curl -u ${1} https://api.bitbucket.org/1.0/users/${1} | jq -r '.repositories[] | .slug')
vcs=git # or hg
for repo_name in $repos
do
echo -e "\tFetching $repo_name"
$vcs clone "ssh://[email protected]/${1}/$repo_name"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment