Last active
December 12, 2015 04:58
-
-
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.
This file contains 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
// 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