- 
      
- 
        Save egabancho/66bd0b04c4926e826d2ff56e29fc258f to your computer and use it in GitHub Desktop. 
    Clone all repositories under a user or organization
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | #!/usr/bin/ruby | |
| require 'open-uri' | |
| require 'json' | |
| user = 'imathis' | |
| repos = open("https://api.github.com/users/#{user}/repos") { |f| | |
| JSON.parse(f.readlines.join) | |
| } | |
| FileUtils.mkdir_p('~/workspace/#{user}') | |
| repos.each do |repo| | |
| `git clone #{repo['ssh_url']} ~/workspace/#{user}/#{repo['name']}` | |
| puts "cloned #{repo['name']} to ~/workspace/#{user}/#{repo['name']}" | |
| end | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment