Skip to content

Instantly share code, notes, and snippets.

@todgru
Forked from ghedo/gist_backup.pl
Created January 25, 2013 00:52
Show Gist options
  • Save todgru/4630515 to your computer and use it in GitHub Desktop.
Save todgru/4630515 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use v5.10;
use strict;
use warnings;
# Usage: gist_backup.pl <user>
# Clone all the gists of a GitHub user
use Git::Raw;
use WWW::GitHub::Gist;
my $user = shift or die 'Provide a user name';
my $gist = WWW::GitHub::Gist -> new(user => $user);
my $gists = $gist -> list;
foreach (@$gists) {
print "Cloning gist '" . $_ -> {'id'} . "'...";
Git::Raw::Repository -> clone($_ -> {'git_pull_url'}, $_ -> {'id'}, 0);
say " done.";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment