You need to adjust the GITHUB_ORGANIZATION to your needs.
touch clone-org.sh chmod +x clone-org.sh
You need to load your SSH KEY,
else you will run into the following error:
Permission denied (publickey).
fatal: The remote end hung up unexpectedly.
Take care!
Filecontent:
#!/bin/bash # The script clones all repositories of an GitHub organization. # # Author: Jens A. Koch # Date: 24.09.2012 # # the github organization to fetch all repositories for GITHUB_ORGANIZATION="WPN-XM" # the git clone cmd used for cloning each repository # the parameter recursive is used to clone submodules, too. GIT_CLONE_CMD="git clone --quiet --mirror --recursive " # fetch repository list via github api # grep fetches the json object key ssh_url, which contains the ssh url for the repository REPOLIST=`curl --silent https://api.github.com/orgs/${GITHUB_ORGANIZATION}/repos -q | grep "\"ssh_url\"" | awk -F': "' '{print $2}' | sed -e 's/",//g'` # loop over all repository urls and execute clone for REPO in $REPOLIST; do ${GIT_CLONE_CMD}${REPO} done
November 4th, 2013 at 11:02
This doesn’t work if the organization has so many repositories that they are split onto several pages.
Github adds a Link header then, e.g. in https://api.github.com/orgs/pear/repos
November 19th, 2013 at 13:48
When i find the time, i will take a look at this issue.