Skip to content

Instantly share code, notes, and snippets.

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 =
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{repo.full_name}.git #{dest}"
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.