Advertisement
gheja

Clone all own public and private GitHub repos/projects

Jul 2nd, 2018
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. ### Clone all public GitHub repositories
  2. # source: https://twitter.com/MaximeEuziere/status/914795875997769731
  3. # Thanks xem (@MaximeEuziere)!
  4. #
  5. # Note: only 100 repos can be queried at once, check "page" parameter.
  6.  
  7. curl "https://api.github.com/users/<USERNAME>/repos?page=1&per_page=100" | grep -e 'git_url*' | cut -d \" -f 4 | xargs -L1 git clone
  8.  
  9. ### Clone all GitHub repositories, including private ones.
  10. # This needs an access token (that can also be used as a password when cloning), how to get one:
  11. # 1. Go to https://github.com/settings/tokens
  12. # 2. Click "Generate new token"
  13. # 3. Add some description, check "repo" scope, click "Generate token"
  14. # 4. Copy the token in the green line beside the tick mark
  15. #
  16. # Note: this way the token gets a lot of unneeded privileges (ex. write to private repos) but it cannot be refined, see
  17. # https://developer.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/
  18. #
  19. # Note: only 100 repos can be queried at once, check "page" parameter.
  20.  
  21. wget -O - "https://api.github.com/user/repos?access_token=<TOKEN>&page=1&per_page=100" | grep -e "clone_url*" | cut -d \" -f 4 | sed -r "s,https://,https://<USERNAME>:<TOKEN>@," | xargs -L1 git clone
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement