Skip to content

Instantly share code, notes, and snippets.

@ghedo
Last active September 1, 2021 18:25
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save ghedo/3657403 to your computer and use it in GitHub Desktop.
Save ghedo/3657403 to your computer and use it in GitHub Desktop.
Clone all the gists of a GitHub user
#!/usr/bin/perl
# Usage: gist_backup.pl <user>
# Clone all the gists of a GitHub user
use strict;
use warnings;
use Git::Raw;
use Pithub::Gists;
my $gist = Pithub::Gists -> new;
my $user = shift or die 'Provide a user name';
my $gists = $gist -> list(user => $user);
while (my $row = $gists -> next) {
print "Cloning gist '" . $row -> {'id'} . "'...";
Git::Raw::Repository -> clone($row -> {'git_pull_url'}, $row -> {'id'}, {});
print " done.\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment