Skip to content

Instantly share code, notes, and snippets.

@benpdavison
Created November 15, 2018 11:16
Show Gist options
  • Save benpdavison/a4f517036eb0b79392e47aebf3c05665 to your computer and use it in GitHub Desktop.
Save benpdavison/a4f517036eb0b79392e47aebf3c05665 to your computer and use it in GitHub Desktop.
Clone All Repos from GitHub Organisation including Private Repos
# For this to work you will need a Personal Access Token for your account
# I allowed all the permission for the personal access token as I deleted it straight after use.
# If your organisation uses SSO, you need to allow it on the personal acces token.
# Replace PERSONAL_ACCESS_TOKEN with the personal access token that is generated.
# Replace YOU_GITHUB_ORG with your organisation name.
# Thanks goes to caniszczyk for the original script, available here: https://gist.github.com/caniszczyk/3856584
# There are non Ruby version available on the original discussion, however I found this to be most reliable.
curl -H "Authorization: token PERSONAL_ACCESS_TOKEN" https://api.github.com/orgs/YOU_GITHUB_ORG/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment