Skip to content

Instantly share code, notes, and snippets.

@ntalbott
Created April 11, 2011 21:46
Show Gist options
  • Save ntalbott/914429 to your computer and use it in GitHub Desktop.
Save ntalbott/914429 to your computer and use it in GitHub Desktop.
Github Repo Archive Script
#!/usr/bin/env ruby
target = ARGV[0]
dest = ARGV[1]
unless target && dest
puts "Github Archive Usage: gharch <user/repo> <destdir>"
exit(1)
end
remote, repo = target.split("/")
`mkdir -p ~/tmp/repowork`
`git clone git@github.com:#{remote}/#{repo}.git ~/tmp/repowork/#{repo}`
`git init --bare ~/tmp/repowork/#{repo}.git`
`cd ~/tmp/repowork/#{repo} && git push --mirror ~/tmp/repowork/#{repo}.git`
`cd ~/tmp/repowork && zip -r #{dest}/#{repo}.zip #{repo}.git`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment