Skip to content

Instantly share code, notes, and snippets.

@StefanScherer
Created April 10, 2015 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StefanScherer/8215213c94a78234f7d6 to your computer and use it in GitHub Desktop.
Save StefanScherer/8215213c94a78234f7d6 to your computer and use it in GitHub Desktop.
Get all repos from GitHub or BitBucket
#!/bin/bash
# Script to get all repositories under a user from bitbucket
# Usage: getAllBitBucketRepos.sh [username]
repos=$(curl -u ${1} https://api.bitbucket.org/1.0/users/${1} | jq ".repositories[].name" | sed -e 's/^"//' -e 's/"$//')
for repo_name in $repos
do
git clone git@bitbucket.org:${1}/$repo_name.git
done
#!/bin/bash
# Script to get all repositories und a GitHub organization
# Usage: getAllGitHubOrgRepos.sh [username:password] [orgname]
repos=$(curl -u ${1} -s https://api.github.com/orgs/${2}/repos?per_page=200 | jq ".[].clone_url" | sed -e 's/^"//' -e 's/"$//')
for repo_name in $repos
do
echo $repo_name
git clone ${repo_name}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment