Clone all github and bitbucket repos in one go

Clone all your github repos in one command

curl -u <<username>> -s https://api.github.com/users/<<username>>/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'

Clone all your bitbucket repos in one command

#!/bin/bash
#script to get all repositories under a user from bitbucket
#Usage: getAllRepos.sh [username]

curl -u ${1} https://api.bitbucket.org/1.0/users/${1} > repoinfo
for repo_name in `grep -oE '\"name\": "[^"]*"' repoinfo | cut -f4 -d\"`
do
 git clone git@bitbucket.org:${1}/$repo_name.git
done

References:

  1. http://haroldsoh.com/2011/10/07/clone-all-repos-from-a-bitbucket-source/
  2. https://gist.github.com/caniszczyk/3856584
Proudly powered by WordPress | Theme: Outfit Blog by Crimson Themes.