Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@svallory
Last active December 12, 2015 04:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save svallory/4718253 to your computer and use it in GitHub Desktop.
Save svallory/4718253 to your computer and use it in GitHub Desktop.
Generate shell script to clone all your repositories, or a configured subset of them from your GitHub Dashboard.
// Instructions:
// 1. Navigate to you GitHub dashboard, either (https://github.com or https://github.com/organizations/{org_name}
// 2. Click on "All repositories" or "Show N more repositories" to show all your repos
// 3. Open Firebug console, and paste this script. Optionally, change the options below
// 4. Run and have fun
var options = {
origin: "all", // can be: source, fork or all
visibility: "all", // can be: public, private or all
showInNewWindow: true
};
console.clear();
// you can change the query to match
var query = '#repo_listing li';
if(options.visibility != 'all')
query += '.' + options.visibility
if(options.origin != 'all')
query += '.' + options.origin;
// only private repos (you also need to comment the
var urls = $(query + ' a').map(function(i,a) {
return $(a).attr('href');
});
var str = "#!/bin/sh\n\n";
urls.map(function(i, u) {
str += "echo Clonning " + u + "\n";
str += "git clone https://github.com" + u + ".git ";
str += u + "\n\n";
});
console.log(str);
if(options.showInNewWindow)
{
var win = window.open('result');
win.document.write('<pre>' + str + '</pre>');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment