{"id":1626,"date":"2018-10-13T13:00:12","date_gmt":"2018-10-13T12:00:12","guid":{"rendered":"http:\/\/chewett.co.uk\/blog\/?p=1626"},"modified":"2018-10-13T14:11:18","modified_gmt":"2018-10-13T13:11:18","slug":"create-clone-commands-for-all-repositories-on-a-github-page","status":"publish","type":"post","link":"https:\/\/chewett.co.uk\/blog\/1626\/create-clone-commands-for-all-repositories-on-a-github-page\/","title":{"rendered":"Create Clone Commands for all Repositories on a GitHub page"},"content":{"rendered":"<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1629\" data-permalink=\"https:\/\/chewett.co.uk\/blog\/1626\/create-clone-commands-for-all-repositories-on-a-github-page\/download_all_github_repos\/\" data-orig-file=\"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/10\/download_all_github_repos.jpg?fit=800%2C300&amp;ssl=1\" data-orig-size=\"800,300\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"download_all_github_repos\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/10\/download_all_github_repos.jpg?fit=300%2C113&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/10\/download_all_github_repos.jpg?fit=678%2C254&amp;ssl=1\" class=\"aligncenter size-full wp-image-1629\" src=\"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/10\/download_all_github_repos.jpg?resize=678%2C254\" alt=\"\" width=\"678\" height=\"254\" srcset=\"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/10\/download_all_github_repos.jpg?w=800&amp;ssl=1 800w, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/10\/download_all_github_repos.jpg?resize=300%2C113&amp;ssl=1 300w, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/10\/download_all_github_repos.jpg?resize=768%2C288&amp;ssl=1 768w, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/10\/download_all_github_repos.jpg?resize=50%2C19&amp;ssl=1 50w\" sizes=\"auto, (max-width: 678px) 100vw, 678px\" \/><\/p>\n<p>This post talks about how you can create git clone links for all the repositories from a GitHub page.<\/p>\n<p><!--more--><\/p>\n<h2>Creating a list of clone commands from a list of Repositories<\/h2>\n<p>To run this code to create the list of commands you need to open your browsers console\u00a0window.<\/p>\n<p>On Chrome you can press Ctrl-Shift-J<br \/>\nOn Firefox you can press F12<\/p>\n<p>Once the console is open, paste in the following command into the console.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">gitCloneCommands=&#x5B;];\r\ndocument.querySelectorAll(&quot;a&#x5B;itemprop='name codeRepository']&quot;).forEach(\r\n\u00a0 \u00a0function(a) { gitCloneCommands.push(&quot;git clone &quot; + a.href); }\r\n);\r\nconsole.log(gitCloneCommands.join(&quot;\\r\\n&quot;))<\/pre>\n<p>This will print out several lines of text, each with a git clone command which can be run in your console.<\/p>\n<p>If you need to tweak the clone command you just need to modify the central function:<\/p>\n<pre>function(a) { gitCloneCommands.push(\"git clone \" + a.href); }<\/pre>\n<p>The value of <code>a.href<\/code> will always be the HTTPS link to the repository which can be changed as needed.<\/p>\n<p>This relies on the current structure of the GitHub webpage. If this changes and no longer works leave a comment and I will have another look and update it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post talks about how you can create git clone links for all the repositories from a GitHub page.<\/p>\n","protected":false},"author":1,"featured_media":1630,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"Today I write about a small snippet of #JavaScript to create clone commands for all the #GitHub #Git repositories on a page","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[5],"tags":[228,76,72],"class_list":["post-1626","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-informational","tag-git","tag-github","tag-javascript"],"wppr_data":{"cwp_meta_box_check":"No"},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/10\/download_all_github_repos-1.jpg?fit=800%2C800&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p2toWX-qe","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":1026,"url":"https:\/\/chewett.co.uk\/blog\/1026\/cloning-multiple-git-repositories-remote-host-clone-repos\/","url_meta":{"origin":1626,"position":0},"title":"Cloning multiple git repositories from a remote host with clone-all-the-repos","author":"Chewett","date":"February 21, 2018","format":false,"excerpt":"This post goes into details about what the clone-all-the-repos\u00a0GitHub\u00a0repository does and why it does it. What is clone-all-the-repos GitHub repository I have a number of git repositories on a couple of servers that I want to clone at once. Manually doing this each time I set up a development environment\u00a0is\u2026","rel":"","context":"In &quot;Software&quot;","block_context":{"text":"Software","link":"https:\/\/chewett.co.uk\/blog\/category\/software\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/02\/clone_all_the_repos_github.jpg?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/02\/clone_all_the_repos_github.jpg?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/02\/clone_all_the_repos_github.jpg?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/02\/clone_all_the_repos_github.jpg?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":519,"url":"https:\/\/chewett.co.uk\/blog\/519\/configuring-teamcity-php-project\/","url_meta":{"origin":1626,"position":1},"title":"Configuring TeamCity for a PHP project","author":"Chewett","date":"September 16, 2017","format":false,"excerpt":"This post describes configuring TeamCity for a PHP project using composer. Setting up continuous integration of unit testing from a git repository. Setting up PHP, composer and git The first step to running your PHP project on TeamCity is installing PHP and the appropriate\u00a0libraries. The only requirement for this is\u2026","rel":"","context":"In &quot;Informational&quot;","block_context":{"text":"Informational","link":"https:\/\/chewett.co.uk\/blog\/category\/informational\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/09\/configuring_php_unit_testing_with_teamcity.jpg?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/09\/configuring_php_unit_testing_with_teamcity.jpg?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/09\/configuring_php_unit_testing_with_teamcity.jpg?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/09\/configuring_php_unit_testing_with_teamcity.jpg?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":1839,"url":"https:\/\/chewett.co.uk\/blog\/1839\/raspberry-pi-cluster-node-08-slave-helper-functions\/","url_meta":{"origin":1626,"position":2},"title":"Raspberry Pi Cluster Node &#8211; 08 Slave Helper Functions","author":"Chewett","date":"December 19, 2018","format":false,"excerpt":"This post builds on\u00a0my previous posts in the Raspberry Pi Cluster series\u00a0by adding a number of slave helper functions.\u00a0 This update will begin the process of fully automating the slaves. Preparing the Slaves for Automation Before the slaves are ready to be fully automated there are a number of commands\u2026","rel":"","context":"In &quot;Raspberry Pi Cluster&quot;","block_context":{"text":"Raspberry Pi Cluster","link":"https:\/\/chewett.co.uk\/blog\/category\/raspberry-pi-cluster\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/12\/rpi_cluster_08_slave_functions.jpg?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/12\/rpi_cluster_08_slave_functions.jpg?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/12\/rpi_cluster_08_slave_functions.jpg?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/12\/rpi_cluster_08_slave_functions.jpg?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":343,"url":"https:\/\/chewett.co.uk\/blog\/343\/raspberrypivcgencmd-python-library-access-raspberry-pi-vcgencmd-command\/","url_meta":{"origin":1626,"position":3},"title":"RaspberryPiVcgencmd A python library to access Raspberry Pi vcgencmd command","author":"Chewett","date":"May 31, 2017","format":false,"excerpt":"To access some of the lower level aspects of the Raspberry Pi's config you can use the built in command vcgencmd. This is a useful on the command line but to easily access it in a program you need to parse the output. I am planning to use this command\u2026","rel":"","context":"In &quot;Raspberry Pi Cluster&quot;","block_context":{"text":"Raspberry Pi Cluster","link":"https:\/\/chewett.co.uk\/blog\/category\/raspberry-pi-cluster\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/05\/vcgencmd.png?fit=628%2C288&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/05\/vcgencmd.png?fit=628%2C288&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/05\/vcgencmd.png?fit=628%2C288&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":409,"url":"https:\/\/chewett.co.uk\/blog\/409\/setting-raspberry-pi-cluster-node\/","url_meta":{"origin":1626,"position":4},"title":"Setting up a Raspberry Pi Cluster Node","author":"Chewett","date":"August 19, 2017","format":false,"excerpt":"To set up a Raspberry Pi node I will follow a specific set of steps so that every Pi is set up \u00a0similarly. For the initial deployment I will follow this once and then clone the SD Card multiple times. If at a later date more are added I will\u2026","rel":"","context":"In &quot;Raspberry Pi Cluster&quot;","block_context":{"text":"Raspberry Pi Cluster","link":"https:\/\/chewett.co.uk\/blog\/category\/raspberry-pi-cluster\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/08\/setting_up_a_raspi_cluster_node.jpg?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/08\/setting_up_a_raspi_cluster_node.jpg?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/08\/setting_up_a_raspi_cluster_node.jpg?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/08\/setting_up_a_raspi_cluster_node.jpg?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":453,"url":"https:\/\/chewett.co.uk\/blog\/453\/automatic-installation-commonly-used-packages\/","url_meta":{"origin":1626,"position":5},"title":"Automatic installation of commonly used packages","author":"Chewett","date":"July 15, 2017","format":false,"excerpt":"A number of years ago I was introduced to using Linux day to day. During this period of time I ran a large number of virtual machines to test its performance and various aspects which make it \"linux\". Typically when I first set up a system I would install a\u2026","rel":"","context":"In &quot;Informational&quot;","block_context":{"text":"Informational","link":"https:\/\/chewett.co.uk\/blog\/category\/informational\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/posts\/1626","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=1626"}],"version-history":[{"count":4,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/posts\/1626\/revisions"}],"predecessor-version":[{"id":1632,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/posts\/1626\/revisions\/1632"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/media\/1630"}],"wp:attachment":[{"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=1626"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=1626"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=1626"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}