Skip to content

Instantly share code, notes, and snippets.

@dbgrandi
Created September 16, 2009 20:19
Show Gist options
  • Save dbgrandi/188171 to your computer and use it in GitHub Desktop.
Save dbgrandi/188171 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
#
# grab a full copy of all my github code.
#
# assumptions: github.user and github.token are set in git
#
require 'yaml'
user = `git config --get github.username`.strip
token = `git config --get github.token`.strip
results = `curl -s -F 'login=#{user}' -F 'token=#{token}' http://github.com/api/v2/yaml/repos/show/#{user}`
yaml_results = YAML.load results
yaml_results['repositories'].each do |repo|
print"Grabbing #{repo[:name]}..."
`mkdir #{repo[:name]}`
`cd #{repo[:name]}`
`git clone git@github.com:#{user}/#{repo[:name]}.git`
puts "done"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment