Created
May 20, 2017 09:09
-
-
Save akira345/54e876c9b7c80f47dd72fe7e2f782bbb to your computer and use it in GitHub Desktop.
GitHubから自分のリポジトリをまとめてcloneする。(公開リポジトリのみ)
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
# Use 'ruby clone-github.rb' | |
# ユーザー名とかdepthオプションは自分で書き換えてください。 | |
require "json" | |
require "open-uri" | |
response = open("https://api.github.com/users/Hiroto-K/repos?per_page=100").read | |
JSON.parse(response).each do |info| | |
clone_url = info["ssh_url"] | |
to = info["name"] | |
if File.exists?(to) | |
puts "Skip '#{to}'" | |
next | |
end | |
puts "Clone '#{clone_url}' to '#{to}'" | |
puts %x(git clone #{clone_url} #{to}) | |
end | |
puts "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment