Skip to content

Instantly share code, notes, and snippets.

@vioan
Created October 25, 2013 19:36
Show Gist options
  • Save vioan/7160581 to your computer and use it in GitHub Desktop.
Save vioan/7160581 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
#
# https://github.com/jooray/github-backup
#
require "yaml"
require "open-uri"
require "shellwords"
# your github username
username = "USERNAME"
backupDirectory = Shellwords.escape("PATH_TO_BACKUPS")
YAML.load(open("https://api.github.com/users/#{username}/repos")).map{|repository|
puts "Discovered repository: #{repository['name']}"
system "git clone #{Shellwords.escape(repository['clone_url'])} #{backupDirectory}/#{Shellwords.escape(repository['name'])}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment