Clone all github repos of an organization

sometimes you need just everything at once

A developers logbook

Posted on 2014-09-19

Clone all repos of an organization

During the live coding session of Nico, I needed to get all content of bpmn.io. Instead of cloning every repository on its own, I used this gist.

And because it is such a nice feature, I wrapped it in a function:

function git.github.clone.organization() {
    if [ $# -ne 0 ]
    then
        mkdir $1
        cd $1
        curl -s https://api.github.com/orgs/$1/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
    else
        echo "git.github.clone.organization <organization>"
    fi
}

Thanks, caniszczyk!


🕸️