Skip to content

Instantly share code, notes, and snippets.

@weisjohn
Created November 16, 2012 02:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weisjohn/4083500 to your computer and use it in GitHub Desktop.
Save weisjohn/4083500 to your computer and use it in GitHub Desktop.
clone all my repos using the Github API
var request = require('request'),
u = require('underscore')
exec = require('child_process').exec,
child = null,
repos = null;
request('https://api.github.com/users/weisjohn/repos', function (error, response, body) {
if (!error && response.statusCode == 200) {
// grab all the repos from github
repos = JSON.parse(body);
// retrive the ssh locations, process them one by one
var urls = u.pluck(repos, 'ssh_url');
u.each(urls, function(ssh_url) {
child = exec('git clone ' + ssh_url, function (error, stdout, stderr) {
console.log(stdout);
console.error(stderr);
if (error !== null) {
console.log('exec error: ' + error);
}
});
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment