Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Backup All Repos
#!/usr/bin/env ruby
# > TOKEN=[PERSONAL ACCESS TOKEN] ruby backup.rb
require 'octokit'
directory = './backups'
client = Octokit::Client.new(
access_token: ENV['TOKEN'],
per_page: 200,
auto_paginate: true
)
client.repos.each do |repo|
puts repo.full_name
dest = "#{directory}/#{repo.full_name}"
system "git clone --quiet git@github.com:#{repo.full_name}.git #{dest}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.