Skip to content

Instantly share code, notes, and snippets.

@caarlos0
Created November 26, 2015 18:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caarlos0/6c177192fd825a235534 to your computer and use it in GitHub Desktop.
Save caarlos0/6c177192fd825a235534 to your computer and use it in GitHub Desktop.
Clone all repositories in any given organization.
# clone-all-org-repos.rb
#
# Clone all repositories in any given organization.
#
# Dependencies:
# - octokit
# - celluloid
#
# Usage:
# TOKEN="your-token" ruby clone-all-org-repos.rb TheOrganizationName
#
require 'octokit'
require 'celluloid/current'
client = Octokit::Client.new(
access_token: ENV['TOKEN'],
auto_traversal: true,
auto_paginate: true
)
organization = ARGV[0]
puts "Cloning #{organization}..."
futures = []
client.org_repos(organization).map do |repo|
futures << Celluloid::Future.new { `git clone #{repo.ssh_url}` }
end
futures.each { |f| puts f.value }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment