Created
September 21, 2013 02:32
-
-
Save mlbright/6646603 to your computer and use it in GitHub Desktop.
backup acg-git.autodesk.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Cwd qw(abs_path getcwd); | |
use File::Path qw(make_path); | |
use File::Spec; | |
my $backup_dir = "/home/backup"; | |
my $domain = 'acg-git.autodesk.com'; | |
my $base = "ssh://$domain"; | |
my @repos = `ssh $domain "perl bin/repolist.pl"` | |
; # https://gist.github.com/mlbright/6646553 | |
for my $repo (@repos) { | |
chomp $repo; | |
my $path = "$backup_dir$repo"; | |
print "repo: $path\n"; | |
if ( -e $path ) { | |
my $cwd = getcwd(); | |
chdir $path; | |
`git remote update`; | |
chdir $cwd; | |
} | |
else { | |
make_path($path); | |
my $url = "$base$repo"; | |
`git clone --mirror $url $path`; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment