#gitback 0.1
#credits: Walter White, Updates: Addy Osmani
#!/usr/bin/env ruby
# dependencies
require "yaml"
require "open-uri"
# your github username
username = "addyosmani"
time = Time.new
# feel free to comment out the option you don't wish to use.
backupDirectory = "~/backups/github/#{time.year}.#{time.month}.#{time.day}"
#or simply: backupDirectory = "/backups/github/"
#repositories =
# .map{|r| %Q[#{r[:name]}] }
#FileUtils.mkdir_p #{backupDirectory}
YAML.load(open("http://github.com/api/v2/yaml/repos/show/#{username}"))['repositories'].map{|repository|
    puts "discovered repository: #{repository[:name]} ... backing up ..."
    #exec
    system "git clone git@github.com:#{username}/#{repository[:name]}.git #{backupDirectory}/#{repository[:name]}"
}
#gitback 0.1
#credits: Walter White, Updates: Addy Osmani
#!/usr/bin/env ruby
# dependencies
require "yaml"
require "open-uri"
# your github username
username = "addyosmani"
time = Time.new
# feel free to comment out the option you don't wish to use.
backupDirectory = "~/backups/github/#{time.year}.#{time.month}.#{time.day}"
#or simply: backupDirectory = "/backups/github/"
#repositories =
# .map{|r| %Q[#{r[:name]}] }
#FileUtils.mkdir_p #{backupDirectory}
YAML.load(open("https://github.com/api/v2/yaml/repos/show/#{username}"))['repositories'].map{|repository|
    puts "discovered repository: #{repository[:name]} ... backing up ..."
    #exec
    system "git clone git@github.com:#{username}/#{repository[:name]}.git #{backupDirectory}/#{repository[:name]}"
}
Use HTTPS to connect to GitHub
Use HTTPS to connect to GitHub

It is mandatory, without this change code will error:

/usr/lib/ruby/2.1.0/open-uri.rb:223:in `open_loop': redirection forbidden: http://github.com/api/v2/yaml/repos/show/irnc -> https://github.com/api/v2/yaml/repos/show/irnc (RuntimeError)
